From f4b78a288c9e5c2a7a05d71b9bbe9e5fc26f2a63 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Mon, 30 Mar 2020 11:45:18 +0300 Subject: MTX-3262 mpower lockfile rewrite for libmts-io compatibility --- src/atcmd.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/atcmd.c') diff --git a/src/atcmd.c b/src/atcmd.c index 97fd34b..e85758d 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -1471,7 +1471,7 @@ static int sms_atcmd_init(int fd) return 0; } -static char *lock_path; +static struct Lock *lock_file; int sms_device_close(int fd) { @@ -1479,11 +1479,7 @@ int sms_device_close(int fd) ret = tty_close(fd); - if (lock_path) { - unlink(lock_path); - free(lock_path); - lock_path = NULL; - } + lock_file = device_unlock(lock_file); return ret; } @@ -1498,8 +1494,8 @@ int sms_device_open(void) return -1; } - lock_path = device_lock(Global.core.device); - if (!lock_path) { + lock_file = device_lock(Global.core.device); + if (!lock_file) { sms_device_close(fd); return -1; } -- cgit v1.2.3