mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-14 23:46:10 +00:00
77 lines
1.4 KiB
Plaintext
77 lines
1.4 KiB
Plaintext
|
diff -ur --unidirectional-new-file skipsrc-1.0.orig/skip/keymgrd/skipd.C skipsrc-1.0/skip/keymgrd/skipd.C
|
||
|
--- skipsrc-1.0.orig/skip/keymgrd/skipd.C Fri Oct 25 13:12:54 1996
|
||
|
+++ skipsrc-1.0/skip/keymgrd/skipd.C Thu Dec 4 18:25:47 1997
|
||
|
@@ -48,6 +48,7 @@
|
||
|
* System includes
|
||
|
*/
|
||
|
#include <skip_os.h>
|
||
|
+#include <err.h>
|
||
|
|
||
|
/*
|
||
|
* SKIP includes
|
||
|
@@ -84,8 +85,9 @@
|
||
|
{
|
||
|
int c;
|
||
|
int errflag = 0;
|
||
|
+ int noFork = 0;
|
||
|
|
||
|
- while ((c = getopt(argc, argv, "vV?")) != EOF) {
|
||
|
+ while ((c = getopt(argc, argv, "nvV?")) != EOF) {
|
||
|
switch(c) {
|
||
|
case 'v':
|
||
|
verbose = 1;
|
||
|
@@ -95,6 +97,9 @@
|
||
|
verbose = 2;
|
||
|
break;
|
||
|
|
||
|
+ case 'n':
|
||
|
+ noFork = 1;
|
||
|
+ break;
|
||
|
case '?':
|
||
|
default:
|
||
|
errflag++;
|
||
|
@@ -106,34 +111,18 @@
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
+ if (!noFork)
|
||
|
{
|
||
|
- extern FILE *skip_log_fp;
|
||
|
-
|
||
|
- skip_log_fp = fopen("/var/log/skipd.log", "w+");
|
||
|
+ extern int skip_log_syslog;
|
||
|
|
||
|
- // if open fails, skip_log will default to stdout/stderr
|
||
|
+ /* output to syslog */
|
||
|
+ openlog("skipd", 0, LOG_DAEMON);
|
||
|
+ skip_log_syslog = 1;
|
||
|
+
|
||
|
+ /* become a background daemon */
|
||
|
+ if (daemon(0, 0))
|
||
|
+ err(1, "daemon");
|
||
|
}
|
||
|
-
|
||
|
-
|
||
|
-// put ourselves into the background
|
||
|
-
|
||
|
- switch (fork()) {
|
||
|
- case -1:
|
||
|
- skip_log(SKIP_ERROR, "fork failed");
|
||
|
- exit(1);
|
||
|
-
|
||
|
- case 0:
|
||
|
- break;
|
||
|
-
|
||
|
- default:
|
||
|
- exit(0);
|
||
|
- }
|
||
|
-
|
||
|
- setsid();
|
||
|
-
|
||
|
- freopen("/dev/null", "r", stdin);
|
||
|
- freopen("/dev/null", "w", stdout);
|
||
|
- freopen("/dev/null", "w", stderr);
|
||
|
|
||
|
skip_init();
|
||
|
skipd_loop();
|