Package: inadyn Severity: normal Tags: patch When inadyn detects an error (for example due to incorrect configuration), the original error code gets lost, and instead the error code for the final cleanup operation is returned from "main", which is typically "0".
-- System Information: Debian Release: 7.6 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
--- main.c.orig 2014-08-25 20:27:19.000000000 +0200 +++ main.c 2014-08-25 20:34:00.000000000 +0200 @@ -47,6 +47,7 @@ int inadyn_main(int argc, char* argv[]) { RC_TYPE rc = RC_OK; + RC_TYPE rc_destruct = RC_OK; DYN_DNS_CLIENT *p_dyndns = NULL; do @@ -62,7 +63,7 @@ while(0); /* end of program */ - if (rc != 0) + if (rc != RC_OK) { print_help_page(); /* log error*/ @@ -70,15 +71,15 @@ } /* destroy DYN_DNS_CLIENT object*/ - rc = dyn_dns_destruct(p_dyndns); - if (rc != RC_OK) + rc_destruct = dyn_dns_destruct(p_dyndns); + if (rc_destruct != RC_OK) { - DBG_PRINTF((LOG_WARNING,"W:" MODULE_TAG "Main: Error '%s' (0x%x) in dyn_dns_destruct().\n", errorcode_get_name(rc), rc)); + DBG_PRINTF((LOG_WARNING,"W:" MODULE_TAG "Main: Error '%s' (0x%x) in dyn_dns_destruct().\n", errorcode_get_name(rc_destruct), rc_destruct)); } os_close_dbg_output(); - return (int) rc; + return (int) ((rc != RC_OK) ? rc : rc_destruct); }