Commit Graph
1 Commits
Author SHA1 Message Date
Brian, Sam bb9e9a92a3 port-serial: don't close tty file descriptor twice
After the tty is opened, the fd is passed off to a GIOChannel which
manages it. When the serial port is closed with _close_internal(),
g_io_channel_shutdown() is called which then calls g_io_unix_close() which
in turn close()s the fd.
_close_internal() performs a second explicit close() after the
g_io_channel_shutdown() which *in the best case scenario* will fail with
EBADF.
This is a race condition that can result in other file descriptors being
closed.

This change avoids double closing the serial port fd -- the shutdown() call
is removed in favour of the explicit close().
2018-06-22 10:54:01 +02:00