diff options
author | Robert Bays <robert@vyatta.com> | 2010-07-14 14:52:46 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2010-07-14 14:52:46 -0700 |
commit | 0984d02b0beb7a453b4ab9a92335d404908073e0 (patch) | |
tree | 131fd5a7351fd5854d484855341c6e6bcb661936 /lib | |
parent | f16a11dc823d3eae8b6825b296131da03e2259c4 (diff) | |
download | vyatta-cfg-quagga-0984d02b0beb7a453b4ab9a92335d404908073e0.tar.gz vyatta-cfg-quagga-0984d02b0beb7a453b4ab9a92335d404908073e0.zip |
fix for bug 5811
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Vyatta/Quagga/Config.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm index 4f3a9d36..21aadb2a 100644 --- a/lib/Vyatta/Quagga/Config.pm +++ b/lib/Vyatta/Quagga/Config.pm @@ -219,7 +219,27 @@ sub _sendQuaggaCommand { push (@arg_array, "$section"); } - system(@arg_array) == 0 or die "_sendQuaggaCommand: @arg_array failed: $?"; + system(@arg_array) == 0 or _logger(\@arg_array, 1); + + return 1; +} + +# log error message to syslog, optionally die +# input: $1 - reference to error message array +# $2 - die boolean +sub _logger { + my $error_array = shift; + my $die = shift; + my @logger_cmd = ("/usr/bin/logger"); + + push (@logger_cmd, "-i"); + push (@logger_cmd, "-t vyatta-cfg-quagga"); + if ($_DEBUG) { push (@logger_cmd, "-s"); } + push (@logger_cmd, "@{$error_array} failed: $?"); + + system(@logger_cmd) == 0 or die "unable to log system error message."; + + if ($die) { die "Error configuring routing subsystem. See log for more detailed information\n"; } return 1; } |