summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-14 17:54:48 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-14 17:54:48 -0800
commitdb48fb251547dac1a8c7064be37c923c2a9bd209 (patch)
tree46c20a7e00b7b0575c1ebeb62fe7ceb943bff0ab /scripts
parent018569a6e5783672db7763b0762afe194a585aa3 (diff)
downloadvyatta-cfg-db48fb251547dac1a8c7064be37c923c2a9bd209.tar.gz
vyatta-cfg-db48fb251547dac1a8c7064be37c923c2a9bd209.zip
Check result of system commands
Make sure and check if system commands worked.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-interfaces.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 43f5f96..ad47614 100644
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -100,7 +100,8 @@ sub touch {
my $file = shift;
my $t = time;
- sysopen (my $f, $file, O_RDWR|O_CREAT) or die "Can't touch $file";
+ sysopen (my $f, $file, O_RDWR|O_CREAT)
+ or die "Can't touch $file: $!";
close $f;
utime $t, $t, $file;
}
@@ -255,7 +256,8 @@ sub run_dhclient {
dhcp_update_config($intf_config_file, $intf);
my $cmd = "$dhcp_daemon -q -nw -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file $intf 2> /dev/null &";
# adding & at the end to make the process into a daemon immediately
- system ($cmd);
+ system ($cmd) == 0
+ or warn "start $dhcp_daemon failed: $?\n";
}
sub stop_dhclient {
@@ -263,7 +265,8 @@ sub stop_dhclient {
my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = generate_dhclient_intf_files($intf);
my $release_cmd = "$dhcp_daemon -q -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file -r $intf 2> /dev/null";
- system ($release_cmd);
+ system ($release_cmd) == 0
+ or warn "stop $dhcp_daemon failed: $?\n";
unlink ($intf_config_file);
}