diff --git a/backup-config/backup-config-lib.pl b/backup-config/backup-config-lib.pl
index 04ff4b37d..5ef8deb0b 100755
--- a/backup-config/backup-config-lib.pl
+++ b/backup-config/backup-config-lib.pl
@@ -18,9 +18,9 @@ our (%text, $module_config_directory, %config);
&init_config();
&foreign_require("cron", "cron-lib.pl");
-my $cron_cmd = "$module_config_directory/backup.pl";
-my $backups_dir = "$module_config_directory/backups";
-my $manifests_dir = "/tmp/backup-config-manifests";
+our $cron_cmd = "$module_config_directory/backup.pl";
+our $backups_dir = "$module_config_directory/backups";
+our $manifests_dir = "/tmp/backup-config-manifests";
=head2 list_backup_modules
@@ -331,9 +331,11 @@ if ($_[4]) {
# Add other files
foreach my $f (@{$_[6]}) {
+ next if (!$f);
if (-d $f) {
# A directory .. recursively expand
foreach my $sf (&expand_directory($f)) {
+ next if (!$sf);
push(@files, $sf);
push(@{$manifestfiles{"other"}}, $sf);
}
@@ -360,7 +362,7 @@ foreach $m (@mods, "_others") {
}
# Make sure we have something to do
-@files = grep { -e $_ } @files;
+@files = grep { $_ && -e $_ } @files;
@files || (return $text{'backup_enone'});
if (!$_[5]) {
@@ -669,11 +671,13 @@ if ($mode == 0) {
}
elsif ($mode == 1) {
return &text($port ? 'nice_ftpp' : 'nice_ftp',
- "$server", "$path", "$port");
+ "$server", "$path",
+ $port ? "$port" : "");
}
elsif ($mode == 2) {
return &text($port ? 'nice_sshp' : 'nice_ssh',
- "$server", "$path", "$port");
+ "$server", "$path",
+ $port ? "$port" : "");
}
elsif ($mode == 3) {
return $text{'nice_upload'};
diff --git a/backup-config/backup.pl b/backup-config/backup.pl
index d9739d2fe..a0358d4a9 100755
--- a/backup-config/backup.pl
+++ b/backup-config/backup.pl
@@ -14,7 +14,7 @@ $backup || die "Failed to find backup $ARGV[0]";
# Run the pre-backup command, if any
my $err;
-my $premsg;
+my $premsg = "";
if ($backup->{'pre'} =~ /\S/) {
my $preout = &backquote_command("($backup->{'pre'}) 2>&1 {'pre'})."\n".
@@ -34,7 +34,7 @@ if (!$err) {
}
# Run the post-backup command, if any
-my $postmsg;
+my $postmsg = "";
if (!$err && $backup->{'post'} =~ /\S/) {
my $postout = &backquote_command("($backup->{'post'}) 2>&1 {'emode'} == 0) && $backup->{'email'}) {
my $host = &get_system_hostname();
my $nice = &nice_dest($backup->{'dest'}, 1);
$nice =~ s/<[^>]+>//g;
- $err =~ s/<[^>]+>//g;
my $msg;
my $subject;
if ($err) {
+ $err =~ s/<[^>]+>//g;
$msg = $premsg.
$text{'email_mods'}."\n".
$mlist.