From: Christian Brauner Date: Sat, 29 Oct 2016 10:03:49 +0000 (+0200) Subject: lxc_monitord: use lxc_safe_int() && use exit() X-Git-Tag: lxc-2.1.0~257^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e5af997d30a75817c5ad9de046948383c914bdd;p=thirdparty%2Flxc.git lxc_monitord: use lxc_safe_int() && use exit() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/lxc_monitord.c b/src/lxc/lxc_monitord.c index c317cbe78..61c8411fb 100644 --- a/src/lxc/lxc_monitord.c +++ b/src/lxc/lxc_monitord.c @@ -362,14 +362,15 @@ int main(int argc, char *argv[]) ret = snprintf(logpath, sizeof(logpath), "%s/lxc-monitord.log", (strcmp(LXCPATH, lxcpath) ? lxcpath : LOGPATH ) ); if (ret < 0 || ret >= sizeof(logpath)) - return EXIT_FAILURE; + exit(EXIT_FAILURE); ret = lxc_log_init(NULL, logpath, "NOTICE", "lxc-monitord", 0, lxcpath); if (ret) INFO("Failed to open log file %s, log will be lost", lxcpath); lxc_log_options_no_override(); - pipefd = atoi(argv[2]); + if (lxc_safe_int(argv[2], &pipefd) < 0) + exit(EXIT_FAILURE); if (sigfillset(&mask) || sigdelset(&mask, SIGILL) || @@ -378,7 +379,7 @@ int main(int argc, char *argv[]) sigdelset(&mask, SIGTERM) || sigprocmask(SIG_BLOCK, &mask, NULL)) { SYSERROR("failed to set signal mask"); - return 1; + exit(EXIT_FAILURE); } signal(SIGILL, lxc_monitord_sig_handler); @@ -428,7 +429,5 @@ int main(int argc, char *argv[]) ret = EXIT_SUCCESS; NOTICE("monitor exiting"); out: - if (ret == 0) - return 0; - return 1; + exit(ret); }