Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Mar 2005 13:58:58 +0300
From:      goblin@nnt.ru
To:        freebsd-ports@freebsd.org
Cc:        joseph@randomnetworks.com
Subject:   security/swatch-3.1.1_1 fails to stop if using /usr/bin/tail
Message-ID:  <1242596738.20050309135858@nnt.ru>

next in thread | raw e-mail | index | archive | help
Hello freebsd-ports,

if using swatch with /usr/bin/tail <file>, it does not want to stop
on /usr/local/etc/rc.d/swatch.sh stop

if someone need, here is patch to fix it quick

--- swatch.orig Wed Mar  9 13:47:26 2005
+++ swatch      Wed Mar  9 13:47:23 2005
@@ -762,0 +763 @@
+my \$tail_pid = 0;
@@ -777,0 +779 @@
+  kill(15, $tail_pid) if $tail_pid;
@@ -832 +834 @@
-    $code .= qq[print \"\\n*** ${Me} version ${VERSION} (pid:$$) started at \" . `/bin/date` . \"\\n\";];
+    $code .= qq[print \"\\n*** ${Me} version ${VERSION} (pid:\$\$) started at \" . `/bin/date` . \"\\n\";];
@@ -897,2 +899,11 @@
-if (not open(TAIL, \"$tail_cmd_name $tail_cmd_args \$filename|\")) {
-    die "$0: cannot read run \\"$tail_cmd_name $tail_cmd_args \$filename\\": \$!\\n";
+local (*TAIL, *WH);
+pipe TAIL, WH;
+\$tail_pid = fork;
+if(!\$tail_pid) {
+       die "$0: cannot fork: \$!\\n" unless defined \$tail_pid;
+       close STDOUT;
+       open STDOUT, ">\\&WH";
+       close TAIL;
+       exec \"$tail_cmd_name $tail_cmd_args \$filename\";
+       die "$0: cannot exec \\"$tail_cmd_name $tail_cmd_args \$filename\\": \$!\\n";
+       POSIX::_exit(-1);
@@ -900 +911 @@
-
+close WH;

-- 
Best regards,
 goblin                          mailto:goblin@nnt.ru




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1242596738.20050309135858>