Sign bit smeared in TIOCLGET
mike%brl-vgr at sri-unix.UUCP
mike%brl-vgr at sri-unix.UUCP
Fri Dec 16 10:56:11 AEST 1983
From: Michael John Muuss <mike at brl-vgr>
Index: sys/sys/tty.c 4.2BSD
Description:
If the high bit of the "local flags" is set, TIOCLGET smears
that bit across the high halfword of the int by the >>16.
Credit for finding this goes to Doug Gwyn, <Gwyn at BRL>.
Repeat-By:
Set the bit with TIOCLSET, and read it back with TIOCLGET.
Fix:
Mask the data. See diff -c listing below.
*** tty.c~ Thu Dec 15 19:47:12 1983
--- tty.c Thu Dec 15 19:48:14 1983
***************
break;
case TIOCLGET:
! *(int *)data = tp->t_flags >> 16;
break;
/* should allow SPGRP and GPGRP only if tty open for reading */
--------------
break;
case TIOCLGET:
! *(int *)data = (tp->t_flags >> 16) & 0xFFFF;
break;
/* should allow SPGRP and GPGRP only if tty open for reading */
More information about the Comp.unix.wizards
mailing list