Change in osmo-e1d[master]: ctl.c: Fix off-by-one: FD=0 is a valid file descriptor

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
Mon Jun 29 12:11:13 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19043 )


Change subject: ctl.c: Fix off-by-one: FD=0 is a valid file descriptor
......................................................................

ctl.c: Fix off-by-one: FD=0 is a valid file descriptor

It is possible that fd=0 (stdin) is closed in a daemon scenario, and
subsequently fd=0 is reused for other files/sockets.

Change-Id: Id8279f04373e891009224bab34a4d1d886520fea
---
M src/ctl.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/43/19043/1

diff --git a/src/ctl.c b/src/ctl.c
index f6e9311..0d6c313 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -96,7 +96,7 @@
 {
 	ts->mode = E1_TS_MODE_OFF;
 
-	if (ts->fd > 0) {
+	if (ts->fd >= 0) {
 		close(ts->fd);
 		ts->fd = -1;
 	}

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

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Id8279f04373e891009224bab34a4d1d886520fea
Gerrit-Change-Number: 19043
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/862f4c0d/attachment.htm>


More information about the gerrit-log mailing list