ptsname: reject invalid file descriptors
authorEric Blake <eblake@redhat.com>
Tue, 2 Oct 2012 18:22:19 +0000 (12:22 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 2 Oct 2012 18:28:25 +0000 (12:28 -0600)
commitb5b92d84e19423e7de0935abd79a2b7c6df213c2
tree55e0fabc0c02cd256ceda7c458b654e1686c8060
parent064a0470a540a6e98af12c4bc1d1f98b423b4660
ptsname: reject invalid file descriptors

POSIX left errno undefined on ptsname() failure, although there
has at least been an effort to specify reasonable values to use:
http://www.austingroupbugs.net/view.php?id=503

However, our tests for ptsname and ptsname_r already require errno
to be set to useful values (as in glibc), so it is worth replacing
ptsname on FreeBSD 8.2 in order to get better QoI and pass the test.

* m4/ptsname.m4 (gl_FUNC_PTSNAME): Probe for FreeBSD bug.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Add new witness.
* modules/stdlib (Makefile.am): Replace witness.
* lib/stdlib.in.h (ptsname): Allow for replacement.
* modules/ptsname (configure.ac): Trigger replacement.
* doc/posix-functions/ptsname.texi (ptsname): Document this.
ChangeLog
doc/posix-functions/ptsname.texi
lib/stdlib.in.h
m4/ptsname.m4
m4/stdlib_h.m4
modules/ptsname
modules/stdlib