diff options
author | unknown <unknown@unknown> | 2008-12-17 03:43:51 +0000 |
---|---|---|
committer | unknown <unknown@unknown> | 2008-12-17 03:43:51 +0000 |
commit | 09f0f026fd4931b90016d0090778983da01c294a (patch) | |
tree | d47c450de794595ce6395bde6ff084d75dac48a4 /bin/control_rancid.in | |
parent | b73f299e731fbddae095c0b5eff04717b6dce1af (diff) | |
download | rancid-09f0f026fd4931b90016d0090778983da01c294a.tar.gz rancid-09f0f026fd4931b90016d0090778983da01c294a.tar.xz rancid-09f0f026fd4931b90016d0090778983da01c294a.zip |
Imported from rancid-2.3.2a9.tar.gz.rancid-2.3.2a9
Diffstat (limited to 'bin/control_rancid.in')
-rw-r--r-- | bin/control_rancid.in | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/bin/control_rancid.in b/bin/control_rancid.in index 13b15f8..2e39068 100644 --- a/bin/control_rancid.in +++ b/bin/control_rancid.in @@ -3,7 +3,7 @@ ## $Id$ ## ## @PACKAGE@ @VERSION@ -## Copyright (c) 1997-2007 by Terrapin Communications, Inc. +## Copyright (c) 1997-2008 by Terrapin Communications, Inc. ## All rights reserved. ## ## This code is derived from software contributed to and maintained by @@ -419,8 +419,8 @@ do done echo -# Make sure that no empty configs are accepted. Those that are non-empty -# are renamed from device_name.new -> device_name. +# Make sure that no empty/truncated configs are accepted. The remainder are +# renamed from device_name.new -> device_name. for router in `cat $devlistfile` do OFS=$IFS @@ -433,9 +433,19 @@ do then rm -f $router.new else - mv $router.new $router - if [ $? -ne 0 ]; then - echo "Error: could not rename $router.new to $router" + lines=`awk '{if (/^([-*!;#]|\/\*)/) { next; } lines++; \ + if (lines > 10) { print "1"; exit;}} \ + END { if (lines < 10) {print "0";}}' $router.new` + + if [ ! $lines ] + then + rm -f $router.new + else + mv $router.new $router + if [ $? -ne 0 ]; then + echo "Error: could not rename $router.new to $router" + rm -f $router.new + fi fi fi done |