diff options
Diffstat (limited to 'main/arpwatch/21_all_arpwatch-2.1a15-pid-filename.patch')
-rw-r--r-- | main/arpwatch/21_all_arpwatch-2.1a15-pid-filename.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/main/arpwatch/21_all_arpwatch-2.1a15-pid-filename.patch b/main/arpwatch/21_all_arpwatch-2.1a15-pid-filename.patch new file mode 100644 index 0000000000..af4d6ca51c --- /dev/null +++ b/main/arpwatch/21_all_arpwatch-2.1a15-pid-filename.patch @@ -0,0 +1,108 @@ +--- ./arpwatch.8.orig 2007-03-27 22:06:16.000000000 +0400 ++++ ./arpwatch.8 2007-03-27 22:08:41.000000000 +0400 +@@ -88,6 +88,12 @@ + .br + .ti +9 + [ ++.B -P ++.I pid_path ++] ++.br ++.ti +9 ++[ + .B -a + ] + .br +@@ -204,6 +210,10 @@ + YMMV. (This feature comes from Debian). + .LP + The ++.B -P ++flag is used to specify pid filename. Default is set to /var/run/arpwatch.pid. ++.LP ++The + .B -a + flag tells + .B arpwatch +--- ./arpwatch.h.orig 2007-03-27 21:36:50.000000000 +0400 ++++ ./arpwatch.h 2007-03-27 21:37:17.000000000 +0400 +@@ -1,6 +1,7 @@ + /* @(#) $Id: arpwatch.h,v 1.29 2000/09/30 23:40:49 leres Exp $ (LBL) */ + + #define ARPFILE "arp.dat" ++#define PIDFILENAME "/var/run/arpwatch.pid" + /*#define ETHERCODES "ethercodes.dat" */ + #define CHECKPOINT (15*60) /* Checkpoint time in seconds */ + +--- ./arpwatch.c.orig 2007-03-27 21:31:18.000000000 +0400 ++++ ./arpwatch.c 2007-03-27 22:04:15.000000000 +0400 +@@ -108,6 +108,8 @@ + + char *prog; + char *path_sendmail = PATH_SENDMAIL; ++char *pidname = PIDFILENAME; ++int nofork = 0; + + int can_checkpoint; + int swapped; +@@ -179,7 +181,6 @@ + struct bpf_program code; + char errbuf[PCAP_ERRBUF_SIZE]; + char* username = NULL; +- int nofork = 0; + int restart = 0; + int restarting_loop = 0; + char options[] = +@@ -194,6 +195,7 @@ + "m:" + "s:" + "p" ++ "P:" + "a" + "u:" + "R:" +@@ -202,6 +204,7 @@ + "z:" + ; + char *tmpptr; ++ FILE *pidfile; + + if (argv[0] == NULL) + prog = "arpwatch"; +@@ -274,6 +277,10 @@ + ++nopromisc; + break; + ++ case 'P': ++ pidname = optarg; ++ break; ++ + case 'a': + ++allsubnets; + break; +@@ -342,6 +349,15 @@ + exit(1); + } else if (pid != 0) + exit(0); ++ pidfile = fopen(pidname, "w"); ++ if(pidfile) { ++ int pid = (int)getpid(); ++ fprintf(pidfile, "%d\n", pid); ++ fclose(pidfile); ++ syslog(LOG_INFO, "Wrote pid %d to %s", pid, pidname); ++ } ++ else ++ fprintf(stderr, "Couldn't write pid file\n"); + } + (void)close(fileno(stdin)); + (void)close(fileno(stdout)); +@@ -870,6 +886,9 @@ + { + + syslog(LOG_DEBUG, "exiting"); ++ if (!debug && !nofork) ++ if(!unlink(pidname)) ++ syslog(LOG_DEBUG, "unable to remove pid file %s", pidname); + checkpoint(0); + exit(1); + } |