dbus_bool_t was_pending_activation;
DBusString command;
int limit;
+ DBusSpawnFlags flags = DBUS_SPAWN_NONE;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
dbus_error_init (&tmp_error);
+ if (bus_context_get_using_syslog (activation->context))
+ flags |= DBUS_SPAWN_REDIRECT_OUTPUT;
+
if (!_dbus_spawn_async_with_babysitter (&pending_activation->babysitter,
service_name,
argv,
envp,
+ flags,
child_setup,
activation,
&tmp_error))
return context->initial_fd_limit;
}
+dbus_bool_t
+bus_context_get_using_syslog (BusContext *context)
+{
+ return context->syslog;
+}
+
void
bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char *msg, ...)
{
int bus_context_get_max_replies_per_connection (BusContext *context);
int bus_context_get_reply_timeout (BusContext *context);
DBusRLimit * bus_context_get_initial_fd_limit (BusContext *context);
+dbus_bool_t bus_context_get_using_syslog (BusContext *context);
void bus_context_log (BusContext *context,
DBusSystemLogSeverity severity,
const char *msg,
argv[0] = "/this/does/not/exist/32542sdgafgafdg";
if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_nonexistent", argv,
- NULL, NULL, NULL,
+ NULL, DBUS_SPAWN_NONE, NULL, NULL,
&error))
{
_dbus_babysitter_block_for_child_exit (sitter);
}
if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_segfault", argv,
- NULL, NULL, NULL,
+ NULL, DBUS_SPAWN_NONE, NULL, NULL,
&error))
{
_dbus_babysitter_block_for_child_exit (sitter);
}
if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_exit", argv,
- NULL, NULL, NULL,
+ NULL, DBUS_SPAWN_NONE, NULL, NULL,
&error))
{
_dbus_babysitter_block_for_child_exit (sitter);
}
if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_and_kill", argv,
- NULL, NULL, NULL,
+ NULL, DBUS_SPAWN_NONE, NULL, NULL,
&error))
{
_dbus_babysitter_kill_child (sitter);
const char *log_name,
char **argv,
char **envp,
+ DBusSpawnFlags flags _DBUS_GNUC_UNUSED,
DBusSpawnChildSetupFunc child_setup _DBUS_GNUC_UNUSED,
void *user_data _DBUS_GNUC_UNUSED,
DBusError *error)
const char *log_name,
char **argv,
char **env,
+ DBusSpawnFlags flags,
DBusSpawnChildSetupFunc child_setup,
void *user_data,
DBusError *error)
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
#ifdef HAVE_SYSTEMD
- /* This may fail, but it's not critical.
- * In particular, if we were compiled with journald support but are now
- * running on a non-systemd system, this is going to fail, so we
- * have to cope gracefully. */
- fd_out = sd_journal_stream_fd (sitter->log_name, LOG_INFO, FALSE);
- fd_err = sd_journal_stream_fd (sitter->log_name, LOG_WARNING, FALSE);
+ if (flags & DBUS_SPAWN_REDIRECT_OUTPUT)
+ {
+ /* This may fail, but it's not critical.
+ * In particular, if we were compiled with journald support but are now
+ * running on a non-systemd system, this is going to fail, so we
+ * have to cope gracefully. */
+ fd_out = sd_journal_stream_fd (sitter->log_name, LOG_INFO, FALSE);
+ fd_err = sd_journal_stream_fd (sitter->log_name, LOG_WARNING, FALSE);
+ }
#endif
pid = fork ();
typedef void (* DBusBabysitterFinishedFunc) (DBusBabysitter *sitter,
void *user_data);
+typedef enum {
+ DBUS_SPAWN_REDIRECT_OUTPUT = (1 << 0),
+ DBUS_SPAWN_NONE = 0
+} DBusSpawnFlags;
+
dbus_bool_t _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p,
const char *log_name,
char **argv,
char **env,
+ DBusSpawnFlags flags,
DBusSpawnChildSetupFunc child_setup,
void *user_data,
DBusError *error);
argv_copy [i] = argv[i + 1];
argv_copy[argc - 1] = NULL;
- if (!_dbus_spawn_async_with_babysitter (NULL, argv_copy[0], argv_copy, NULL, setup_func, NULL, &error))
+ if (!_dbus_spawn_async_with_babysitter (NULL, argv_copy[0], argv_copy, NULL,
+ DBUS_SPAWN_NONE, setup_func, NULL,
+ &error))
{
fprintf (stderr, "Could not launch application: \"%s\"\n",
error.message);