summaryrefslogtreecommitdiff
path: root/src/atcmd.c
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2020-04-13 14:40:47 -0500
committerJeff Hatch <jhatch@multitech.com>2020-04-13 14:40:47 -0500
commit8ce0f4a320f56b582e51cca09ebf8fbc8326987d (patch)
treecf6d684596ddeb198f221b9eaad69ca307e503f4 /src/atcmd.c
parent3d3c735f3bbd269f97bd59a246d5f18b010eda2b (diff)
parentd48fa68d6207b25061d5276021b1dd25ce5da89d (diff)
downloadsms-utils-8ce0f4a320f56b582e51cca09ebf8fbc8326987d.tar.gz
sms-utils-8ce0f4a320f56b582e51cca09ebf8fbc8326987d.tar.bz2
sms-utils-8ce0f4a320f56b582e51cca09ebf8fbc8326987d.zip
Merge branch 'MTX-3262-single-instance-guard' into 'master'
Mtx 3262 single instance guard See merge request !3
Diffstat (limited to 'src/atcmd.c')
-rw-r--r--src/atcmd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/atcmd.c b/src/atcmd.c
index 97fd34b..eab4210 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;
}