Change in libosmocore[master]: libosmovty: simplify condition checking vty->fd in vty_close()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Nov 30 18:49:33 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/16149 )

Change subject: libosmovty: simplify condition checking vty->fd in vty_close()
......................................................................

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
---
M src/vty/vty.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/vty/vty.c b/src/vty/vty.c
index 8cc2a3a..ebdf9fc 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -231,8 +231,8 @@
 	/* 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;
 	}

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/16149
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ied35d142af0ba0f5ad78975b8f22c35b32d6ff71
Gerrit-Change-Number: 16149
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191130/57b9e758/attachment.htm>


More information about the gerrit-log mailing list