Apply MSG_NOSIGNAL to the api using 'send' system call. 21/110821/3
authorjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 18 Jan 2017 06:27:17 +0000 (15:27 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 18 Jan 2017 08:25:54 +0000 (00:25 -0800)
From a certain cause, if the pipe is broken, then the process will be aborted unexpectedly
and the remaining behavior of that process will be skipped.
The SIGPIPE signal cause this abort.
So, to prevent the unexpect abort, the MSG_NOSIGNAL flag can be the solution.
Becuase, this flag turns off the signaling caused by current system call.
Even though the signaling is off, the process could know the pipe error from errno(EPIPE).

Change-Id: Ifd35062947a24982b160f0774546a855332c7b94
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
installer/pkgmgr_installer.c

index bcf44e72dc6f241ce7bcc7f57acf08f235fd7cde..36279ab5c071a9ea0dc61a1e8d200caf566edd47 100644 (file)
@@ -218,7 +218,7 @@ static int __send_signal_to_agent(uid_t uid, void *data, size_t len)
                return -1;
        }
 
-       r = send(fd, data, len, 0);
+       r = send(fd, data, len, MSG_NOSIGNAL);
        if (r < 0) {
                ERR("failed to send data: %d", errno);
                close(fd);