Disable exclusive access mode during close.
When closing the slave side of a pseudo terminal, the exclusive access mode will persists on the master side. The result is that re-opening the slave side will fail with EBUSY, unless the process has root priviliges. To workaround this problem, we already introduced an option that enables better compatibility with pseudo terminals. See commmit fab606b00a44ea2114a4029ad09b70c66c3049f7 for details. In my development environment, I always have this option enabled. But occasionally I also need to test release builds. And then I usually end up with inaccessible pty's again, because the pty support is disabled by default for release build. This problem can easily be avoided by disabling the exclusive access mode, just before closing the file descriptor.
This commit is contained in:
parent
d2eacc5c01
commit
60665ec633
@ -205,6 +205,11 @@ serial_close (serial_t *device)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_PTY
|
||||
// Disable exclusive access mode.
|
||||
ioctl (device->fd, TIOCNXCL, NULL);
|
||||
#endif
|
||||
|
||||
// Close the device.
|
||||
if (close (device->fd) != 0) {
|
||||
SYSERROR (device->context, errno);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user