gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10327 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r10327 - gnunet/src/util
Date: Tue, 16 Feb 2010 13:25:45 +0100

Author: nevans
Date: 2010-02-16 13:25:45 +0100 (Tue, 16 Feb 2010)
New Revision: 10327

Modified:
   gnunet/src/util/os_priority.c
Log:
add stdin functionality for os start process function

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2010-02-16 12:19:23 UTC (rev 10326)
+++ gnunet/src/util/os_priority.c       2010-02-16 12:25:45 UTC (rev 10327)
@@ -127,6 +127,7 @@
 GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, struct 
GNUNET_DISK_PipeHandle *pipe_stdout, const char *filename, ...)
 {
   /* FIXME:  Make this work on windows!!! */
+  /* FIXME:  Make this work with stdin as well as stdout! */
   va_list ap;
 
 #ifndef MINGW
@@ -149,6 +150,8 @@
   va_end (ap);
   if (pipe_stdout != NULL)
     GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle(pipe_stdout, 
GNUNET_DISK_PIPE_END_WRITE), &fd_stdout_write, sizeof (int));
+  if (pipe_stdin != NULL)
+    GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle(pipe_stdout, 
GNUNET_DISK_PIPE_END_READ), &fd_stdin_read, sizeof (int));
 
 #if HAVE_WORKING_VFORK
   ret = vfork ();
@@ -175,17 +178,26 @@
           sleep (1);
           if (pipe_stdout != NULL)
             GNUNET_DISK_pipe_close_end(pipe_stdout, 
GNUNET_DISK_PIPE_END_WRITE);
+          if (pipe_stdin != NULL)
+            GNUNET_DISK_pipe_close_end(pipe_stdin, GNUNET_DISK_PIPE_END_READ);
 #endif
         }
       GNUNET_free (argv);
       return ret;
     }
+
   if (pipe_stdout != NULL)
     {
       dup2(fd_stdout_write, 1);
       close (fd_stdout_write);
     }
 
+  if (pipe_stdout != NULL)
+    {
+      dup2(fd_stdin_read, 0);
+      close (fd_stdin_read);
+    }
+
   execvp (filename, argv);
   GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "execvp", filename);
   _exit (1);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]