Last patch,

in function check_init_fifo() - after open a pipe fd by open() is executing fstat() on this

after successful open a pipe fd by open() and return a vaild fd, next is execute fstat() on this fd without return code test. I added test, but i see, this function

"FIXME:  this needs to be finished..."


so, up to you.

It's my first patchset, with several changes, to I'm ready for comments and complaint :-)

Best regards.

--
Michal Kulling

--- init.c-orig	2014-02-10 21:19:50.558078539 +0100
+++ init.c	2014-02-10 21:20:15.650079136 +0100
@@ -2332,7 +2332,12 @@
    */
   if (pipe_fd < 0) {
 	if ((pipe_fd = open(INIT_FIFO, O_RDWR|O_NONBLOCK)) >= 0) {
-		fstat(pipe_fd, &st);
+		if(fstat(pipe_fd, &t) < 0){
+			initlog(L_VB, "Failed to stat %s", INIT_FIFO);
+			close(pipe_fd);
+			pipe_fd = -1;
+		}
+
 		if (!S_ISFIFO(st.st_mode)) {
 			initlog(L_VB, "%s is not a fifo", INIT_FIFO);
 			close(pipe_fd);

Reply via email to