summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-12-09 00:25:23 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-12-09 00:25:23 +0100
commit782e4b05dd8ea70e1f457607dfd72104529e5d97 (patch)
tree29c76dd652b9feb189628c3ab646437a077cd5c7
parentb03f80e6d7a9248a80eb3ea6a555a336ae582027 (diff)
downloadconnman-782e4b05dd8ea70e1f457607dfd72104529e5d97.tar.gz
connman-782e4b05dd8ea70e1f457607dfd72104529e5d97.tar.bz2
connman-782e4b05dd8ea70e1f457607dfd72104529e5d97.zip
Fix broken flag handling for task spawning
-rw-r--r--include/task.h2
-rw-r--r--src/task.c18
2 files changed, 9 insertions, 11 deletions
diff --git a/include/task.h b/include/task.h
index 2239188d..0d84bab4 100644
--- a/include/task.h
+++ b/include/task.h
@@ -57,7 +57,7 @@ int connman_task_set_notify(struct connman_task *task, const char *member,
int connman_task_run(struct connman_task *task,
connman_task_exit_t function, void *user_data,
- int *fd, int *standard_output, int *standard_error);
+ int *stdin_fd, int *stdout_fd, int *stderr_fd);
int connman_task_stop(struct connman_task *task);
#ifdef __cplusplus
diff --git a/src/task.c b/src/task.c
index 3997307a..74c9b8b5 100644
--- a/src/task.c
+++ b/src/task.c
@@ -273,11 +273,10 @@ static void task_setup(gpointer user_data)
*/
int connman_task_run(struct connman_task *task,
connman_task_exit_t function, void *user_data,
- int *fd, int *standard_output, int *standard_error)
+ int *stdin_fd, int *stdout_fd, int *stderr_fd)
{
+ GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD;
gboolean result;
- GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD |
- G_SPAWN_STDOUT_TO_DEV_NULL;
char **argv, **envp;
DBG("task %p", task);
@@ -285,9 +284,10 @@ int connman_task_run(struct connman_task *task,
if (task->pid > 0)
return -EALREADY;
- if (standard_output == NULL)
+ if (stdout_fd == NULL)
flags |= G_SPAWN_STDOUT_TO_DEV_NULL;
- if (standard_error == NULL)
+
+ if (stderr_fd == NULL)
flags |= G_SPAWN_STDERR_TO_DEV_NULL;
task->exit_func = function;
@@ -320,11 +320,9 @@ int connman_task_run(struct connman_task *task,
argv = (char **) task->argv->pdata;
envp = (char **) task->envp->pdata;
- result = g_spawn_async_with_pipes(NULL, argv, envp,
- G_SPAWN_DO_NOT_REAP_CHILD,
- task_setup, task, &task->pid,
- fd, standard_output,
- standard_output, NULL);
+ result = g_spawn_async_with_pipes(NULL, argv, envp, flags,
+ task_setup, task, &task->pid,
+ stdin_fd, stdout_fd, stderr_fd, NULL);
if (result == FALSE) {
connman_error("Failed to spawn %s", argv[0]);
return -EIO;