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.
This commit is contained in:
Norman Feske 2012-01-06 19:07:34 +01:00
parent 1bd2b0ec08
commit 8cb27e2813
1 changed files with 12 additions and 0 deletions

View File

@ -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;
}
};