gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] Call connect_script only for opened device


From: Ladislav Michl
Subject: [PATCH 1/2] Call connect_script only for opened device
Date: Wed, 21 Nov 2018 11:18:30 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

Previously connect_script was called only with valid fd, restore that.

Fixes: 4d38aee466e6 (Make device_script() generic for all connection types)
Signed-off-by: Ladislav Michl <address@hidden>
---
 common/device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/device.c b/common/device.c
index 1b1daabb..794106b7 100644
--- a/common/device.c
+++ b/common/device.c
@@ -125,6 +125,10 @@ int device_open(const char *file, int with_odd_parity, int 
with_async,
                state->device.fd = -1;
                break;
        }
+
+       if (state->device.fd < 0)
+               return 0;
+
        /*
         * handle config file connect_script:
         */
@@ -134,7 +138,7 @@ int device_open(const char *file, int with_odd_parity, int 
with_async,
                return 0;
        }
 
-       return (state->device.fd >= 0);
+       return 1;
 }
 
 void device_close(struct gn_statemachine *state)
-- 
2.19.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]