fix: neuron daemon lock file permission problem

This commit is contained in:
eeff
2022-05-26 17:43:13 +08:00
parent 99d1b724b6
commit a3dfed3551
+8 -1
View File
@@ -30,6 +30,8 @@
#include <stdlib.h>
#include <string.h>
#include "neuron/log.h"
#include "daemon.h"
void daemonize()
@@ -100,9 +102,12 @@ int neuron_already_running()
int ret = -1;
ssize_t size = -1;
umask(0);
fd = open(NEURON_DAEMON_LOCK_FNAME, O_RDWR | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0) {
log_error("cannot open %s reason: %s\n", NEURON_DAEMON_LOCK_FNAME,
strerror(errno));
exit(1);
}
@@ -113,6 +118,8 @@ int neuron_already_running()
close(fd);
return 1;
}
log_error("cannot lock %s reason: %s\n", NEURON_DAEMON_LOCK_FNAME,
strerror(errno));
exit(1);
}