* lib/unlockpt.c: Include <fcntl.h>.
(unlockpt): Check whether fd is valid, using fcntl().
* modules/unlockpt (Depends-on): Add fcntl-h.
+2011-10-20 Bruno Haible <bruno@clisp.org>
+
+ unlockpt: Detect invalid argument.
+ * lib/unlockpt.c: Include <fcntl.h>.
+ (unlockpt): Check whether fd is valid, using fcntl().
+ * modules/unlockpt (Depends-on): Add fcntl-h.
+
2011-10-20 Bruno Haible <bruno@clisp.org>
openpty: Avoid compilation error on AIX 6.1.
#include <stdlib.h>
+#include <fcntl.h>
#include <unistd.h>
int
#else
/* Assume that the slave side of a pseudo-terminal is already unlocked
by default. */
+ if (fcntl (fd, F_GETFD) < 0)
+ return -1;
return 0;
#endif
}
Depends-on:
stdlib
extensions
+fcntl-h [test $HAVE_UNLOCKPT = 0]
ptsname [test $HAVE_UNLOCKPT = 0]
configure.ac: