summaryrefslogtreecommitdiff
path: root/src/atcmd.c
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2020-04-17 07:54:13 -0500
committerJeff Hatch <jhatch@multitech.com>2020-04-17 07:54:13 -0500
commit203bf8164ae731682b6a524f8c961b6e2de96504 (patch)
tree27dac2df5b3eb57cb80cc5c1cf89a0b3a29142c1 /src/atcmd.c
parent8ce0f4a320f56b582e51cca09ebf8fbc8326987d (diff)
parenta2eda5de55c7176a345b3a1e0d5a45b5773455c7 (diff)
downloadsms-utils-203bf8164ae731682b6a524f8c961b6e2de96504.tar.gz
sms-utils-203bf8164ae731682b6a524f8c961b6e2de96504.tar.bz2
sms-utils-203bf8164ae731682b6a524f8c961b6e2de96504.zip
Merge branch 'MTX-3262-single-instance-guard-revert' into 'master'
Revert "MTX-3262 mpower lockfile rewrite for libmts-io compatibility" See merge request !5
Diffstat (limited to 'src/atcmd.c')
-rw-r--r--src/atcmd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/atcmd.c b/src/atcmd.c
index eab4210..97fd34b 100644
--- a/src/atcmd.c
+++ b/src/atcmd.c
@@ -1471,7 +1471,7 @@ static int sms_atcmd_init(int fd)
return 0;
}
-static struct Lock *lock_file;
+static char *lock_path;
int sms_device_close(int fd)
{
@@ -1479,7 +1479,11 @@ int sms_device_close(int fd)
ret = tty_close(fd);
- lock_file = device_unlock(lock_file);
+ if (lock_path) {
+ unlink(lock_path);
+ free(lock_path);
+ lock_path = NULL;
+ }
return ret;
}
@@ -1494,8 +1498,8 @@ int sms_device_open(void)
return -1;
}
- lock_file = device_lock(Global.core.device);
- if (!lock_file) {
+ lock_path = device_lock(Global.core.device);
+ if (!lock_path) {
sms_device_close(fd);
return -1;
}