[Logcheck-commits] CVS logcheck/src

CVS User jlps-guest logcheck-devel at lists.alioth.debian.org
Sun Feb 12 05:06:28 UTC 2006


Update of /cvsroot/logcheck/logcheck/src
In directory haydn:/tmp/cvs-serv17295

Modified Files:
	logcheck 
Log Message:
Test if the rule file is readable before trying to egrep it, if it's not exit with an error


--- /cvsroot/logcheck/logcheck/src/logcheck	2006/02/12 04:48:19	1.132
+++ /cvsroot/logcheck/logcheck/src/logcheck	2006/02/12 05:06:27	1.133
@@ -22,7 +22,7 @@
 # along with Logcheck; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-# $Id: logcheck,v 1.132 2006/02/12 04:48:19 jlps-guest Exp $
+# $Id: logcheck,v 1.133 2006/02/12 05:06:27 jlps-guest Exp $
 
 if [ $UID == 0 ]; then
     echo "logcheck should not be run as root. Use su to invoke logcheck:"
@@ -211,10 +211,14 @@
 	    rulefile=$(basename $rulefile)
 	    if [ -f ${dir}/${rulefile} ]; then
 		debug "cleanrules: ${dir}/${rulefile}"
-		# pipe to cat on greps to get usable exit status
-		egrep --text -v '^[[:space:]]*$|^#' $dir/$rulefile | cat \
-		    >> $cleaned/$rulefile \
-		    || error "Couldn't append to $cleaned/$rulefile. Disk Full?"
+		if [ -r ${dir}/${rulefile} ]; then
+			# pipe to cat on greps to get usable exit status
+			egrep --text -v '^[[:space:]]*$|^#' $dir/$rulefile | cat \
+		    		>> $cleaned/$rulefile \
+		    	|| error "Couldn't append to $cleaned/$rulefile. Disk Full?"
+		else
+			error "Couldn't read $dir/$rulefile"
+		fi
 	    fi
 	done
     elif [ -f $dir ]; then



More information about the Logcheck-commits mailing list