packages: nagios-plugin-check_asterisk_skype/check_asterisk_skype - detect ...
sparky
sparky at pld-linux.org
Wed Mar 31 13:13:12 CEST 2010
Author: sparky Date: Wed Mar 31 11:13:12 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- detect failed forks correctly
---- Files affected:
packages/nagios-plugin-check_asterisk_skype:
check_asterisk_skype (1.10 -> 1.11)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype
diff -u packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype:1.10 packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype:1.11
--- packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype:1.10 Wed Mar 3 10:52:53 2010
+++ packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype Wed Mar 31 13:13:07 2010
@@ -35,15 +35,15 @@
sub check_skype_license {
my $pid = open(my $fh, '-|');
- if ($pid == 0) {
+ if (not defined $pid) {
+ die("fork() failed: $!");
+ } elsif ($pid == 0) {
# child
# redirect stderr
open STDERR, '>&STDOUT';
my @CMD = ('asterisk', '-rx', 'skype show licenses');
- exec @CMD or die "ERROR: Could not execute '@CMD': $!\n";
-
- } elsif($pid == -1) {
- die("fork() failed");
+ exec @CMD;
+ die "ERROR: Could not execute '@CMD': $!\n";
}
# parent
@@ -77,15 +77,15 @@
sub check_skype_user {
my $pid = open(my $fh, '-|');
- if ($pid == 0) {
+ if (not defined $pid) {
+ die("fork() failed: $!");
+ } elsif ($pid == 0) {
# child
# redirect stderr
open STDERR, '>&STDOUT';
my @CMD = ('asterisk', '-rx', 'skype show users');
- exec @CMD or die "ERROR: Could not execute '@CMD': $!\n";
-
- } elsif($pid == -1) {
- die("fork() failed");
+ exec @CMD;
+ die "ERROR: Could not execute '@CMD': $!\n";
}
# parent
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_asterisk_skype/check_asterisk_skype?r1=1.10&r2=1.11&f=u
More information about the pld-cvs-commit
mailing list