mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-03-11 11:38:34 +01:00
Merge branch '6030_close_socket'
This commit is contained in:
commit
a3095f2dec
2 changed files with 2 additions and 0 deletions
1
config.c
1
config.c
|
|
@ -729,6 +729,7 @@ int cwmp_init(int argc, char** argv,struct cwmp *cwmp)
|
|||
}
|
||||
/* Only One instance should run*/
|
||||
cwmp->pid_file = open("/var/run/cwmpd.pid", O_CREAT | O_RDWR, 0666);
|
||||
fcntl(cwmp->pid_file, F_SETFD, fcntl(cwmp->pid_file, F_GETFD) | FD_CLOEXEC);
|
||||
int rc = flock(cwmp->pid_file, LOCK_EX | LOCK_NB);
|
||||
if(rc) {
|
||||
if(EWOULDBLOCK != errno)
|
||||
|
|
|
|||
1
ubus.c
1
ubus.c
|
|
@ -128,6 +128,7 @@ cwmp_handle_command(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
int error;
|
||||
CWMP_LOG(INFO, "triggered ubus exit");
|
||||
int rc = flock(cwmp_main.pid_file, LOCK_UN | LOCK_NB);
|
||||
close(cwmp_main.pid_file);
|
||||
if(rc) {
|
||||
char *piderr = "PID file unlock failed!";
|
||||
fprintf(stderr, "%s\n", piderr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue