[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23923 - gnunet/src/exit
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23923 - gnunet/src/exit |
Date: |
Thu, 20 Sep 2012 15:48:47 +0200 |
Author: grothoff
Date: 2012-09-20 15:48:47 +0200 (Thu, 20 Sep 2012)
New Revision: 23923
Modified:
gnunet/src/exit/gnunet-helper-exit.c
Log:
give sysctl /dev/null instead of no stdin/stdout
Modified: gnunet/src/exit/gnunet-helper-exit.c
===================================================================
--- gnunet/src/exit/gnunet-helper-exit.c 2012-09-20 13:40:27 UTC (rev
23922)
+++ gnunet/src/exit/gnunet-helper-exit.c 2012-09-20 13:48:47 UTC (rev
23923)
@@ -89,7 +89,33 @@
#endif
+/**
+ * Open '/dev/null' and make the result the given
+ * file descriptor.
+ *
+ * @param target_fd desired FD to point to /dev/null
+ * @param flags open flags (O_RDONLY, O_WRONLY)
+ */
+static void
+open_dev_null (int target_fd,
+ int flags)
+{
+ int fd;
+ fd = open ("/dev/null", flags);
+ if (-1 == fd)
+ abort ();
+ if (fd == target_fd)
+ return;
+ if (-1 == dup2 (fd, target_fd))
+ {
+ (void) close (fd);
+ abort ();
+ }
+ (void) close (fd);
+}
+
+
/**
* Run the given command and wait for it to complete.
*
@@ -119,7 +145,9 @@
/* close stdin/stdout to not cause interference
with the helper's main protocol! */
(void) close (0);
+ open_dev_null (0, O_RDONLY);
(void) close (1);
+ open_dev_null (1, O_WRONLY);
(void) execv (file, cmd);
/* can only get here on error */
fprintf (stderr,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23923 - gnunet/src/exit,
gnunet <=