mirror of
git://github.com/lxc/lxc
synced 2025-08-30 21:29:32 +00:00
lxc_monitord: use lxc_safe_int() && use exit()
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
@@ -362,14 +362,15 @@ int main(int argc, char *argv[])
|
|||||||
ret = snprintf(logpath, sizeof(logpath), "%s/lxc-monitord.log",
|
ret = snprintf(logpath, sizeof(logpath), "%s/lxc-monitord.log",
|
||||||
(strcmp(LXCPATH, lxcpath) ? lxcpath : LOGPATH ) );
|
(strcmp(LXCPATH, lxcpath) ? lxcpath : LOGPATH ) );
|
||||||
if (ret < 0 || ret >= sizeof(logpath))
|
if (ret < 0 || ret >= sizeof(logpath))
|
||||||
return EXIT_FAILURE;
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
ret = lxc_log_init(NULL, logpath, "NOTICE", "lxc-monitord", 0, lxcpath);
|
ret = lxc_log_init(NULL, logpath, "NOTICE", "lxc-monitord", 0, lxcpath);
|
||||||
if (ret)
|
if (ret)
|
||||||
INFO("Failed to open log file %s, log will be lost", lxcpath);
|
INFO("Failed to open log file %s, log will be lost", lxcpath);
|
||||||
lxc_log_options_no_override();
|
lxc_log_options_no_override();
|
||||||
|
|
||||||
pipefd = atoi(argv[2]);
|
if (lxc_safe_int(argv[2], &pipefd) < 0)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
if (sigfillset(&mask) ||
|
if (sigfillset(&mask) ||
|
||||||
sigdelset(&mask, SIGILL) ||
|
sigdelset(&mask, SIGILL) ||
|
||||||
@@ -378,7 +379,7 @@ int main(int argc, char *argv[])
|
|||||||
sigdelset(&mask, SIGTERM) ||
|
sigdelset(&mask, SIGTERM) ||
|
||||||
sigprocmask(SIG_BLOCK, &mask, NULL)) {
|
sigprocmask(SIG_BLOCK, &mask, NULL)) {
|
||||||
SYSERROR("failed to set signal mask");
|
SYSERROR("failed to set signal mask");
|
||||||
return 1;
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGILL, lxc_monitord_sig_handler);
|
signal(SIGILL, lxc_monitord_sig_handler);
|
||||||
@@ -428,7 +429,5 @@ int main(int argc, char *argv[])
|
|||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
NOTICE("monitor exiting");
|
NOTICE("monitor exiting");
|
||||||
out:
|
out:
|
||||||
if (ret == 0)
|
exit(ret);
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user