aboutsummaryrefslogtreecommitdiff
path: root/src/arm/gnunet-arm.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-09 19:04:19 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-09 19:04:19 +0000
commit8f9464256fc06a884bf589b4004262a0549d11b3 (patch)
treea088b8acbebdefe2acf0b41cfed4418830275b78 /src/arm/gnunet-arm.c
parent817ee37a75fb8eb5887023d1a5152cb528ee2d5a (diff)
-LRN: Another take on std descriptor inheritance
Now descriptors are not inherited by default, you have to pass a set of flags to make it so. When pipes are given, flags have no effect. gnunet-arm now has two options to block stdout and stderr from being passed to gnunet-service-arm
Diffstat (limited to 'src/arm/gnunet-arm.c')
-rw-r--r--src/arm/gnunet-arm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 8ce8375e78..84d91355af 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -127,6 +127,16 @@ static struct GNUNET_TIME_Relative timeout;
/**
+ * Do we want to give our stdout to gnunet-service-arm?
+ */
+static unsigned int no_stdout = 0;
+
+/**
+ * Do we want to give our stderr to gnunet-service-arm?
+ */
+static unsigned int no_stderr = 0;
+
+/**
* Main continuation-passing-style loop. Runs the various
* jobs that we've been asked to do in order.
*
@@ -323,6 +333,8 @@ cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (start)
{
GNUNET_ARM_start_service (h, "arm",
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
(0 ==
timeout.rel_value) ? START_TIMEOUT :
timeout, &confirm_cb, "arm");
@@ -333,6 +345,8 @@ cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (init != NULL)
{
GNUNET_ARM_start_service (h, init,
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
(0 ==
timeout.rel_value) ? START_TIMEOUT :
timeout, &confirm_cb, init);
@@ -422,6 +436,10 @@ main (int argc, char *const *argv)
GNUNET_YES, &GNUNET_GETOPT_set_ulong, &temp_timeout_ms},
{'I', "info", NULL, gettext_noop ("List currently running services"),
GNUNET_NO, &GNUNET_GETOPT_set_one, &list},
+ {'O', "no-stdout", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard output"),
+ GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stdout},
+ {'E', "no-stderr", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard error"),
+ GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stderr},
GNUNET_GETOPT_OPTION_END
};