aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-06-29 07:46:07 +0200
committerHarald Welte <laforge@osmocom.org>2020-06-29 22:12:42 +0200
commit8a9392ff44563c40a163d145d13969e99344db0f (patch)
tree47041cd54e28cbe0b362a9192811284baaf196ba
parentb3414ed4cccb9b15cb48a5d9aa6c52c9e8d9c3fa (diff)
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
-rw-r--r--src/ctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ctl.c b/src/ctl.c
index a70556d..dd9155d 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -96,7 +96,7 @@ _e1d_ts_stop(struct e1_ts *ts)
{
ts->mode = E1_TS_MODE_OFF;
- if (ts->fd > 0) {
+ if (ts->fd >= 0) {
close(ts->fd);
ts->fd = -1;
}