security/swatch-3.1.1_1 fails to stop if using /usr/bin/tail
goblin at nnt.ru
goblin at nnt.ru
Wed Mar 9 03:05:03 PST 2005
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 at nnt.ru
More information about the freebsd-ports
mailing list