12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include <errno.h>
- #include <stdlib.h>
- #include <sys/ioctl.h>
- #include <termios.h>
- int
- unlockpt (int fd)
- {
- #ifdef TIOCSPTLCK
- int save_errno = errno;
- int unlock = 0;
- if (ioctl (fd, TIOCSPTLCK, &unlock))
- {
- if (errno == EINVAL)
- {
- errno = save_errno;
- return 0;
- }
- else
- return -1;
- }
- #endif
-
- return 0;
- }
|