[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#121899: No wonder it segfaults



At least, it's not surprising that the "minimal case" Branden provided in
BTS segfaults. It's nothing to do with getpt(); the code is using in
uninitialized pointer *pts.

Barring that, however, I have just confirmed that on libc6 (2.3.1-3),
getpt() does not return an error if /dev/pts is chmod'd to 0, as Branden
suggested. I found that it was still successfully allocating a pty file
descriptor for the pty. However, ptsname() will return a NULL pointer,
because it won't have the permissions to read the pty.

I'm not sure if this should be considered a bug, since getpt() *does*
allocate a new pty, even if it is unreadable. I have confirmed that a new
pty does appear in /dev/pts, and gets removed once the test program exits.
In other words, it *does* successfully allocate a pty and returns the file
descriptor, as described by the .info documentation.

Whether or not getpt() should check for the pty's readability is another
issue, and I don't think libc is "buggy" there either --- one really
should check the return value of ptsname() (or other pts-accessing calls),
which *is* returning NULL in this case when it can't read the pty. 

At any rate, I tried this with xterm, and got:
	xterm: unable to access pty device: Permission denied

I'm not sure if Branden worked around the problem in xterm, or upstream
has fixed the problem. Perhaps this bug should be closed.

HTH.


T

-- 
And life still goes on...



Reply to: