-try with finished
[oweals/gnunet.git] / src / dns / gnunet-helper-dns.c
index 73536c252af4d2c74e407fa49e73d3e6608344c7..5e603ceb8de05c1f13288d3e56c7f7413f0fbe3c 100644 (file)
@@ -173,6 +173,10 @@ fork_and_exec (const char *file,
   if (0 == pid)
   {
     /* we are the child process */
+    /* close stdin/stdout to not cause interference
+       with the helper's main protocol! */
+    (void) close (0); 
+    (void) close (1); 
     (void) execv (file, cmd);
     /* can only get here on error */
     fprintf (stderr, 
@@ -573,6 +577,7 @@ run (int fd_tun)
         bufin_size = read (0, bufin + bufin_rpos, MAX_SIZE - bufin_rpos);
         if (-1 == bufin_size)
         {
+         bufin_read = NULL;
          if ( (errno == EINTR) ||
               (errno == EAGAIN) )
            continue;
@@ -581,6 +586,7 @@ run (int fd_tun)
         }
        if (0 == bufin_size)
         {
+         bufin_read = NULL;
           fprintf (stderr, "EOF on stdin\n");
          return;
         }