From 425402114f3e1cdf88c3a206625cce7ed7a2dbb7 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 6 Dec 2006 16:37:29 +0000 Subject: [PATCH] Tighten up check for 'syslogd -C' git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5064 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/lib.cli | 20 ++++++++++++++++++++ Shorewall/shorewall | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Shorewall/lib.cli b/Shorewall/lib.cli index fb38e7778..a5adb2964 100644 --- a/Shorewall/lib.cli +++ b/Shorewall/lib.cli @@ -120,6 +120,26 @@ timed_read () test $? -eq 2 && sleep $timeout } +# +# Determine if 'syslog -C' is running +# +syslog_circular_buffer() { + local pid tty flags cputime path args arg + + ps ax 2> /dev/null | while read pid tty flags cputime path args; do + case $path in + syslogd|*/syslogd) + for arg in $args; do + if [ x$arg = x-C ]; then + echo Yes + return + fi + done + ;; + esac + done +} + # # Display the last $1 packets logged # diff --git a/Shorewall/shorewall b/Shorewall/shorewall index ade219a93..09726d826 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -128,7 +128,7 @@ get_config() { [ -z "$LOGFILE" ] && LOGFILE=/var/log/messages - if ( ps ax 2> /dev/null | grep -v grep | qt grep 'syslogd.*-C' ) ; then + if [ -n "$(syslog_circular_buffer)" ]; then LOGREAD="logread" elif [ -f $LOGFILE ]; then LOGREAD="cat $LOGFILE"