Bug fix for the rewritten spawn_filter function.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Fri, 17 Aug 2007 15:08:11 +0000 (08:08 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Fri, 17 Aug 2007 15:08:11 +0000 (08:08 -0700)
We were accidentally using the wrong variable (filter_pid instead of pid)
when looking at the result of a fork call, with the result that both
processes thought they were the parent.

store.cc

index caec347..a156a57 100644 (file)
--- a/store.cc
+++ b/store.cc
@@ -98,10 +98,10 @@ int spawn_filter(int fd_out, const char *program, pid_t *filter_pid)
 
     /* Create a child process which can exec() the filter program. */
     pid = fork();
-    if (filter_pid < 0)
+    if (pid < 0)
         throw IOException("Unable to fork filter process");
 
-    if (filter_pid > 0) {
+    if (pid > 0) {
         /* Parent process */
         close(fds[0]);
         cloexec(fds[1]);