update: refactor and rename
This commit is contained in:
10
src/lock.c
10
src/lock.c
@ -4,14 +4,14 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
lock_st lock() {
|
||||
if (exists(mc_lock_path))
|
||||
lock_st lock(char *lock_path) {
|
||||
if (exists(lock_path))
|
||||
return ALREADY_LOCKED;
|
||||
if (creat(mc_lock_path, 0600) == -1)
|
||||
if (creat(lock_path, 0600) == -1)
|
||||
return LOCK_ERROR;
|
||||
return LOCK_SUCCESS;
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
unlink(mc_lock_path);
|
||||
void unlock(char *lock_path) {
|
||||
unlink(lock_path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user