From: Brett Gordon Date: Wed, 7 Oct 2015 20:00:20 +0000 (-0400) Subject: coco3: tty: correct EINVAL/ENOTTY logic. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0d87507133fd95a067ccdcc9b7c51ba30fed3bf9;p=FUZIX.git coco3: tty: correct EINVAL/ENOTTY logic. --- diff --git a/Kernel/platform-coco3/devtty.c b/Kernel/platform-coco3/devtty.c index c30f3357..90b514a7 100644 --- a/Kernel/platform-coco3/devtty.c +++ b/Kernel/platform-coco3/devtty.c @@ -497,24 +497,27 @@ unsigned char vt_map(unsigned char c) int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) { - if ( minor > 2 ) goto error; /* remove once DW get its own ioctl() */ + if ( minor > 2 ) /* remove once DW get its own ioctl() */ + goto notty; if (arg >> 8 != 0x03) return vt_ioctl(minor, arg, ptr); if (arg == GFXIOC_GETINFO) return uput( ptytab[minor-1].fdisp, ptr, sizeof( struct display)); if (arg == GFXIOC_GETMODE){ uint8_t m=ugetc(ptr); - if( m > 3 ) goto error; + if( m > 3 ) goto inval; return uput( &fmodes[m], ptr, sizeof( struct display)); } if (arg == GFXIOC_SETMODE){ uint8_t m=ugetc(ptr); - if( m > 3 ) goto error; + if( m > 3 ) goto inval; memcpy( &(ptytab[minor-1].gime), &(mode[m]), sizeof( struct mode_s ) ); if( minor == curminor ) apply_gime( minor ); return 0; } - error: udata.u_error = EINVAL; + notty: udata.u_error = ENOTTY; + return -1; + inval: udata.u_error = EINVAL; return -1; }