daemon: pass "detach" flag to daemonize()
This way, we don't have to pass the full "Options" object to daemonize().
This commit is contained in:
parent
bfcaecabbd
commit
9c93249412
@ -18,7 +18,8 @@
|
||||
|
||||
#include "daemon.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -133,7 +134,7 @@ daemonize_set_user(void)
|
||||
}
|
||||
|
||||
void
|
||||
daemonize(Options *options)
|
||||
daemonize(bool detach)
|
||||
{
|
||||
#ifndef WIN32
|
||||
FILE *fp = NULL;
|
||||
@ -149,7 +150,7 @@ daemonize(Options *options)
|
||||
}
|
||||
}
|
||||
|
||||
if (options->daemon) {
|
||||
if (detach) {
|
||||
int pid;
|
||||
|
||||
fflush(NULL);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef DAEMON_H
|
||||
#define DAEMON_H
|
||||
|
||||
#include "cmdline.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
void
|
||||
daemonize_init(const char *user, const char *pidfile);
|
||||
@ -47,6 +47,6 @@ void
|
||||
daemonize_set_user(void);
|
||||
|
||||
void
|
||||
daemonize(Options *options);
|
||||
daemonize(bool detach);
|
||||
|
||||
#endif
|
||||
|
@ -245,7 +245,7 @@ int main(int argc, char *argv[])
|
||||
initNormalization();
|
||||
input_stream_global_init();
|
||||
|
||||
daemonize(&options);
|
||||
daemonize(options.daemon);
|
||||
|
||||
setup_log_output(options.stdOutput);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user