Re: [master 5/6] use the new logging approach in imount.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/08/2010 11:03 AM, Martin Sivak wrote:
Hi,

+    rc = readFD(stdout_pipe[0],&buffer);
+    if (rc>  0) {
+        rstrip(buffer);
+        logProgramMessage(INFO, buffer);
+        free(buffer);
+        buffer = NULL;
      }
+    rc = readFD(stderr_pipe[0],&buffer);
+    if (rc>  0) {
+        rstrip(buffer);
+        logProgramMessage(ERROR, buffer);
+        if (err != NULL)
+            *err = buffer;
+        else
+            free(buffer);
+    }
+    close(stdout_pipe[0]);
+    close(stderr_pipe[0]);

-    close(pipefd[0]);
      waitpid(child,&status, 0);

Are you sure this is safe? What about the case when stderr gets filled by enough data to fill the kernel buffer for that pipe while you are waiting for stdout? In my experience the calling program then block until you read some data from the pipe.. but you are waiting for stdout so I think you could end up in deadlock here.

Martin

Nice catch, this is something I did not consider. Looking at 'man 7 pipe' the capacity is 65kB so I will just assume there is not going to be more than that written by mount to stderr or stdout. I'll add a comment about it in the source code. If either problems appear or there's more places we need this construction I am going to come up with a general solution.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux