summaryrefslogtreecommitdiff
path: root/src/atcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/atcmd.c')
-rw-r--r--src/atcmd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/atcmd.c b/src/atcmd.c
index f881808..4eecb50 100644
--- a/src/atcmd.c
+++ b/src/atcmd.c
@@ -1486,7 +1486,7 @@ static int sms_atcmd_init(int fd)
return 0;
}
-static char *lock_path;
+static int lock_file;
int sms_device_close(int fd)
{
@@ -1494,11 +1494,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;
}
@@ -1513,8 +1509,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 < 0) {
sms_device_close(fd);
return -1;
}
@@ -1599,4 +1595,4 @@ int is_quectel_model()
}
return 0;
-}
+} \ No newline at end of file