* fhandler_tty.cc (fhandler_tty_slave::ioctl): Properly set return value in

FIONBIO case.
This commit is contained in:
Christopher Faylor 2003-10-24 01:13:22 +00:00
parent 3ef05bac21
commit e64a50ed4e
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-10-23 Christopher Faylor <cgf@redhat.com>
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Properly set return
value in FIONBIO case.
2003-10-23 Corinna Vinschen <corinna@vinschen.de> 2003-10-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_partitions): Use new device code * fhandler_proc.cc (format_proc_partitions): Use new device code

View File

@ -1025,6 +1025,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
raise (SIGTTOU); raise (SIGTTOU);
} }
int retval;
switch (cmd) switch (cmd)
{ {
case TIOCGWINSZ: case TIOCGWINSZ:
@ -1033,6 +1034,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
break; break;
case FIONBIO: case FIONBIO:
set_nonblocking (*(int *) arg); set_nonblocking (*(int *) arg);
retval = 0;
goto out; goto out;
default: default:
set_errno (EINVAL); set_errno (EINVAL);
@ -1086,14 +1088,14 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
} }
release_output_mutex (); release_output_mutex ();
retval = get_ttyp ()->ioctl_retval;
out:
int retval = get_ttyp ()->ioctl_retval;
if (retval < 0) if (retval < 0)
{ {
set_errno (-retval); set_errno (-retval);
retval = -1; retval = -1;
} }
out:
termios_printf ("%d = ioctl (%x)", retval, cmd); termios_printf ("%d = ioctl (%x)", retval, cmd);
return retval; return retval;
} }