tty: minor fixes to error handling in ioctls
authorAlan Cox <alan@etchedpixels.co.uk>
Tue, 20 Oct 2015 21:09:18 +0000 (22:09 +0100)
committerAlan Cox <alan@etchedpixels.co.uk>
Tue, 20 Oct 2015 21:09:18 +0000 (22:09 +0100)
Kernel/tty.c

index 40e298a..1fd3972 100644 (file)
@@ -225,21 +225,21 @@ int tty_ioctl(uint8_t minor, uarg_t request, char *data)
         }
        switch (request) {
        case TCGETS:
-               uput(&ttydata[minor].termios, data, sizeof(struct termios));
+               return uput(&ttydata[minor].termios, data, sizeof(struct termios));
                break;
+       case TCSETSF:
+               clrq(&ttyinq[minor]);
+               /* Fall through for now */
        case TCSETSW:
                /* We don't have an output queue really so for now drop
                   through */
        case TCSETS:
-       case TCSETSF:
-               uget(data, &ttydata[minor].termios, sizeof(struct termios));
-               if (request == TCSETSF)
-                       clrq(&ttyinq[minor]);
+               if (uget(data, &ttydata[minor].termios, sizeof(struct termios)) == -1)
+                       return -1;
                 tty_setup(minor);
                break;
        case TIOCINQ:
-               uput(&ttyinq[minor].q_count, data, 2);
-               break;
+               return uput(&ttyinq[minor].q_count, data, 2);
        case TIOCFLUSH:
                clrq(&ttyinq[minor]);
                break;