From 8cb27e2813c66a6a9c2094faa4b003f91ec21606 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 6 Jan 2012 19:07:34 +0100 Subject: [PATCH] Let tcgetattr succeed for libc_log At the startup of python's termios module, a sequence of 'tcgetattr' and 'tcsetattr' calls is executed. If one of those calls fails, the initialization gets canceled. 'tcgetattr' is implemented via ioctl operations on stdout. To let those operations succeed, the default implementation of ioctl ('Plugin::ioctl') cannot be used because it returns -1. Adding a dummy ioctl to the libc_log back end alleviates this problem. --- libports/src/lib/libc_log/plugin.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libports/src/lib/libc_log/plugin.cc b/libports/src/lib/libc_log/plugin.cc index d97b61742..11dbe0906 100644 --- a/libports/src/lib/libc_log/plugin.cc +++ b/libports/src/lib/libc_log/plugin.cc @@ -96,6 +96,18 @@ namespace { } return orig_count; } + + int ioctl(Libc::File_descriptor *, int request, char *) + { + /* + * Some programs or libraries use to perform 'TIOCGETA' + * operations on stdout, in particular the termios module of + * Python. Those programs may break if 'tcgetattr' return with + * an error. We pretend to be more successful than we really + * are to make them happy. + */ + return 0; + } };