Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mx_util: Add wrapper for daemon(3) to prevent nameclashes
  • Loading branch information
mariux committed Nov 20, 2015
1 parent dfe84c7 commit 20aea15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mx_util.c
Expand Up @@ -1299,3 +1299,8 @@ int mx_mkdir_p(char *path, mode_t mode)
}
return (stat(copy, &st) && mkdir(copy, mode)) ? -errno : 0;
}

int mx_daemon(int nochdir, int noclose)
{
return daemon(nochdir, noclose);
}
1 change: 1 addition & 0 deletions mx_util.h
Expand Up @@ -164,5 +164,6 @@ int mx_str_to_cpuset(cpu_set_t* cpuset_ptr,char *str);

int mx_mkdir_p(char *path, mode_t mode);

int mx_daemon(int nochdir, int noclose);

#endif
2 changes: 1 addition & 1 deletion mxqd.c
Expand Up @@ -534,7 +534,7 @@ int server_init(struct mxq_server *server, int argc, char *argv[])
}

if (arg_daemonize) {
res = daemon(0, 1);
res = mx_daemon(0, 1);
if (res == -1) {
mx_log_err("MAIN: daemon(0, 1) failed: %m. Exiting.");
return -EX_OSERR;
Expand Down

0 comments on commit 20aea15

Please sign in to comment.