aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2010-02-04 18:43:31 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2010-02-04 18:43:31 +0000
commit93ad9acc6486cf57d39e6f625de13c44fede8444 (patch)
tree719444569551c4096e85dd15e2b40f461cb37769
parent1545edc45a64462d9dc139230b7274e6157f870d (diff)
downloadrpm-helper-93ad9acc6486cf57d39e6f625de13c44fede8444.tar
rpm-helper-93ad9acc6486cf57d39e6f625de13c44fede8444.tar.gz
rpm-helper-93ad9acc6486cf57d39e6f625de13c44fede8444.tar.bz2
rpm-helper-93ad9acc6486cf57d39e6f625de13c44fede8444.tar.xz
rpm-helper-93ad9acc6486cf57d39e6f625de13c44fede8444.zip
check the file exists before deleting it
-rwxr-xr-xdel-syslog4
1 files changed, 4 insertions, 0 deletions
diff --git a/del-syslog b/del-syslog
index 372ed2d..8df0bb8 100755
--- a/del-syslog
+++ b/del-syslog
@@ -32,6 +32,7 @@ sub del_sysklogd_entry {
my ($package) = @_;
my $file = "/etc/syslog.conf";
+
my $content;
open(my $in, '<', $file)
or die "Can't open $file for reading: $!";
@@ -58,6 +59,9 @@ sub del_rsyslog_entry {
my $file = "/etc/rsyslog.d/$package.conf";
+ # check the file exists
+ return unless -f $file;
+
# check the file is the one created by package installation
open(my $in, '<', $file)
or die "Can't open $file for reading: $!";