projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add option to prevent daemonization
[apps/pfixtools.git]
/
main-postlicyd.c
diff --git
a/main-postlicyd.c
b/main-postlicyd.c
index
f9b96f5
..
51f56ef
100644
(file)
--- a/
main-postlicyd.c
+++ b/
main-postlicyd.c
@@
-252,6
+252,7
@@
void usage(void)
"Options:\n"
" -l <port> port to listen to\n"
" -p <pidfile> file to write our pid to\n"
"Options:\n"
" -l <port> port to listen to\n"
" -p <pidfile> file to write our pid to\n"
+ " -f stay in foreground\n"
, stderr);
}
, stderr);
}
@@
-264,10
+265,11
@@
int main(int argc, char *argv[])
.sin_addr = { htonl(INADDR_LOOPBACK) },
};
const char *pidfile = NULL;
.sin_addr = { htonl(INADDR_LOOPBACK) },
};
const char *pidfile = NULL;
+ bool daemonize = true;
int port = DEFAULT_PORT;
int sock = -1;
int port = DEFAULT_PORT;
int sock = -1;
- for (int c = 0; (c = getopt(argc, argv, "h" "l:p:")) >= 0; ) {
+ for (int c = 0; (c = getopt(argc, argv, "h
f
" "l:p:")) >= 0; ) {
switch (c) {
case 'p':
pidfile = optarg;
switch (c) {
case 'p':
pidfile = optarg;
@@
-275,6
+277,9
@@
int main(int argc, char *argv[])
case 'l':
port = atoi(optarg);
break;
case 'l':
port = atoi(optarg);
break;
+ case 'f':
+ daemonize = false;
+ break;
default:
usage();
return EXIT_FAILURE;
default:
usage();
return EXIT_FAILURE;
@@
-296,7
+301,7
@@
int main(int argc, char *argv[])
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
- if (daemon_detach() < 0) {
+ if (daemon
ize && daemon
_detach() < 0) {
syslog(LOG_CRIT, "unable to fork");
return EXIT_FAILURE;
}
syslog(LOG_CRIT, "unable to fork");
return EXIT_FAILURE;
}