[lxc-devel] [lxc/master] monitor: change exit() => _exit() system call in child process

2xsec on Github lxc-bot at linuxcontainers.org
Fri Jun 22 13:44:02 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 416 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180622/e4ba26c9/attachment.bin>
-------------- next part --------------
From f15e4fd2fbcf674a59b66f9a1d03b6b9fd663fa2 Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Fri, 22 Jun 2018 22:42:32 +0900
Subject: [PATCH] monitor: change exit() => _exit() system call in child
 process

Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
 src/lxc/monitor.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c
index e410bede4..ebf2122c0 100644
--- a/src/lxc/monitor.c
+++ b/src/lxc/monitor.c
@@ -324,13 +324,13 @@ int lxc_monitord_spawn(const char *lxcpath)
 
 	if (pipe(pipefd) < 0) {
 		SYSERROR("Failed to create pipe.");
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 
 	pid2 = fork();
 	if (pid2 < 0) {
 		SYSERROR("Failed to fork().");
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 
 	if (pid2) {
@@ -350,18 +350,18 @@ int lxc_monitord_spawn(const char *lxcpath)
 		close(pipefd[0]);
 
 		DEBUG("Successfully synced with child process.");
-		exit(EXIT_SUCCESS);
+		_exit(EXIT_SUCCESS);
 	}
 
 	if (setsid() < 0) {
 		SYSERROR("Failed to setsid().");
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 
 	lxc_check_inherited(NULL, true, &pipefd[1], 1);
 	if (null_stdfds() < 0) {
 		SYSERROR("Failed to dup2() standard file descriptors to /dev/null.");
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 
 	close(pipefd[0]);
@@ -369,7 +369,7 @@ int lxc_monitord_spawn(const char *lxcpath)
 	ret = snprintf(pipefd_str, LXC_NUMSTRLEN64, "%d", pipefd[1]);
 	if (ret < 0 || ret >= LXC_NUMSTRLEN64) {
 		ERROR("Failed to create pid argument to pass to monitord.");
-		exit(EXIT_FAILURE);
+		_exit(EXIT_FAILURE);
 	}
 
 	DEBUG("Using pipe file descriptor %d for monitord.", pipefd[1]);
@@ -377,5 +377,5 @@ int lxc_monitord_spawn(const char *lxcpath)
 	execvp(args[0], args);
 	SYSERROR("failed to exec lxc-monitord");
 
-	exit(EXIT_FAILURE);
+	_exit(EXIT_FAILURE);
 }


More information about the lxc-devel mailing list