/* Unlock the slave side of a pseudo-terminal from its master side.
- Copyright (C) 1998, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2010-2012 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
This program is free software: you can redistribute it and/or modify
#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
}