Currently in make_pipe() is use fcntl() function without return code validation. I added return check - if fcntl() return -1, then put into initlog message and return -1 from make_pipe().

I'm not sure here, but if fcntl() doesn't exit with success return code, so something is wrong here?

--
Michal Kulling

--- init.c-orig	2014-02-10 21:11:53.478067200 +0100
+++ init.c	2014-02-10 21:15:17.598072051 +0100
@@ -2076,8 +2076,17 @@
 	}
 	dup2(fds[0], fd);
 	close(fds[0]);
-	fcntl(fds[1], F_SETFD, 1);
-	fcntl(fd, F_SETFD, 0);
+
+	if(fcntl(fds[1], F_SETFD, 1) == -1){
+		initlog(L_VB, "Failed to set close-on-exec value for pipe");
+		return -1;
+	}
+
+	if(fcntl(fd, F_SETFD, 0) == -1){
+		initlog(L_VB, "Failed to set close-on-exec value for duplicated pipe fd");
+		return -1
+	}
+
 	safe_write(fds[1], Signature, 8);
 
 	return fds[1];

Reply via email to