[nagiosplug] check_apt now correctly exits when apt-get return ...

"Nagios Plugin Development" <[email protected]> Thu, 15 Aug 2013 09:30:17 +0000
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
 Module: nagiosplug
 Branch: master
 Commit: 9be408511cbf10e4e4b5750459bf2a6d2e23d89d
 Author: Richard Leitner <[email protected]>
   Date: Thu May 30 00:05:17 2013 +0200
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=9be4085

check_apt now correctly exits when apt-get return != 0

This commit fixes an issue with check_apt where check_apt doesn't exit
with the appropriate return code when apt-get returned a non-zero value.

---

 plugins/check_apt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 7ec2d55..0e95dc3 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -112,8 +112,8 @@ int main (int argc, char **argv) {
 		result = max_state(result, STATE_CRITICAL);
 	} else if(packages_available > 0){
 		result = max_state(result, STATE_WARNING);
-	} else {
-		result = max_state(result, STATE_OK);
+	} else if(result > STATE_UNKNOWN){
+		result = STATE_UNKNOWN;
 	}
 
 	printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk