dexter has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/32392 )

Change subject: e1d: do not set fd number to 0 after close
......................................................................

e1d: do not set fd number to 0 after close

0 is reserved for STDIN, so lets not set the file descriptor to 0 after
we close it. Lets use -1 instead.

Change-Id: I72e4775135caf4e3727c4f0654a545478c73bb83
Related: OS#5983
---
M src/input/e1d.c
1 file changed, 17 insertions(+), 4 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/input/e1d.c b/src/input/e1d.c
index 44a710d..01da96d 100644
--- a/src/input/e1d.c
+++ b/src/input/e1d.c
@@ -429,13 +429,13 @@
                        }
                        if (bfd->fd) {
                                close(bfd->fd);
-                               bfd->fd = 0;
+                               bfd->fd = -1;
                        }
                         continue;
                case E1INP_TS_TYPE_SIGN:
                        if (bfd->fd > 0 && ts_info[ts].cfg.mode != 
E1DP_TSMODE_HDLCFCS) {
                                close(bfd->fd);
-                               bfd->fd = 0;
+                               bfd->fd = -1;
                        }
                        if (bfd->fd <= 0) {
                                bfd->fd = osmo_e1dp_client_ts_open(g_e1d, 
e1d_intf, e1d_line, ts,
@@ -465,7 +465,7 @@
                        /* close, if old timeslot mode doesn't match new config 
*/
                        if (bfd->fd > 0 && ts_info[ts].cfg.mode != 
E1DP_TSMODE_HDLCFCS) {
                                close(bfd->fd);
-                               bfd->fd = 0;
+                               bfd->fd = -1;
                        }
                        if (bfd->fd <= 0) {
                                bfd->fd = osmo_e1dp_client_ts_open(g_e1d, 
e1d_intf, e1d_line, ts,
@@ -489,7 +489,7 @@
                        /* close, if old timeslot mode doesn't match new config 
*/
                        if (bfd->fd > 0 && ts_info[ts].cfg.mode != 
E1DP_TSMODE_RAW) {
                                close(bfd->fd);
-                               bfd->fd = 0;
+                               bfd->fd = -1;
                        }
                        if (bfd->fd <= 0) {
                                bfd->fd = osmo_e1dp_client_ts_open(g_e1d, 
e1d_intf, e1d_line, ts,

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I72e4775135caf4e3727c4f0654a545478c73bb83
Gerrit-Change-Number: 32392
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-Reviewer: tnt <[email protected]>
Gerrit-MessageType: merged

Reply via email to