[comp.unix.wizards] fchmod on your tty

"oread::barbanis"@CS-UMASS.arpa (01/09/88)

I wanted to change the mode of my tty from a program (something
like biff), so I used:
   fchmod(0,mode)
This worked fine on Ultrix 2.0, but not on Sun rel3.4 (I got
[EPERM]).  When I tried:
   chmod(ttyname(0),mode)
it worked fine on both systems.  Any idea why fchmod didn't
work?

George Barbanis
UMass -- Amherst

budd@bu-cs.BU.EDU (Philip Budne) (01/12/88)

[fchmod(0,....) fails on SUN]

I ran into this bug too.  After reading the source I determined that
the "credentials" attached to the tty fd were from the initial open
(by init as uid 0) and so you were denied access.