mirror of https://gerrit.osmocom.org/libosmocore
libosmovty: simplify condition checking vty->fd in vty_close()
On POSIX systems, standard I/O streams - stdin, stdout, and stderr, always have default file descriptors 0, 1, and 2 respectively. Change-Id: Ied35d142af0ba0f5ad78975b8f22c35b32d6ff71
This commit is contained in:
parent
54df08e3fa
commit
7a35b78648
|
@ -231,8 +231,8 @@ void vty_close(struct vty *vty)
|
|||
/* Unset vector. */
|
||||
vector_unset(vtyvec, vty->fd);
|
||||
|
||||
/* Close socket. */
|
||||
if (vty->fd > 0 && vty->fd != fileno(stderr)) {
|
||||
/* Close socket (ignore standard I/O streams). */
|
||||
if (vty->fd > 2) {
|
||||
close(vty->fd);
|
||||
vty->fd = -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue