[PATCH 1/2] Call connect_script only for opened device
Ladislav Michl <[email protected]> Wed, 21 Nov 2018 11:18:30 +0100
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <20181121101830.GB23678@lenoch> |
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 <[email protected]> --- 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