summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c6
-rw-r--r--netifd.h3
-rw-r--r--proto-shell.c7
3 files changed, 10 insertions, 6 deletions
diff --git a/main.c b/main.c
index abc220e..04d5648 100644
--- a/main.c
+++ b/main.c
@@ -26,7 +26,7 @@ netifd_process_cb(struct uloop_process *proc, int ret)
}
int
-netifd_start_process(const char **argv, char **env, int dir_fd, struct netifd_process *proc)
+netifd_start_process(const char **argv, char **env, struct netifd_process *proc)
{
int pid;
@@ -42,8 +42,8 @@ netifd_start_process(const char **argv, char **env, int dir_fd, struct netifd_pr
env++;
}
}
- if (dir_fd >= 0)
- fchdir(dir_fd);
+ if (proc->dir_fd >= 0)
+ fchdir(proc->dir_fd);
execvp(argv[0], (char **) argv);
exit(127);
}
diff --git a/netifd.h b/netifd.h
index 5eeb5e2..f86fb15 100644
--- a/netifd.h
+++ b/netifd.h
@@ -52,9 +52,10 @@ struct netifd_process {
struct list_head list;
struct uloop_process uloop;
void (*cb)(struct netifd_process *, int ret);
+ int dir_fd;
};
-int netifd_start_process(const char **argv, char **env, int dir_fd, struct netifd_process *proc);
+int netifd_start_process(const char **argv, char **env, struct netifd_process *proc);
void netifd_kill_process(struct netifd_process *proc);
struct device;
diff --git a/proto-shell.c b/proto-shell.c
index 0e1412b..d0028c4 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -86,7 +86,7 @@ proto_shell_handler(struct interface_proto_state *proto,
argv[i++] = proto->iface->main_dev.dev->ifname;
argv[i] = NULL;
- ret = netifd_start_process(argv, NULL, proto_fd, proc);
+ ret = netifd_start_process(argv, NULL, proc);
free(config);
return ret;
@@ -401,7 +401,7 @@ proto_shell_run_command(struct proto_shell_state *state, struct blob_attr **tb)
if (!fill_string_list(tb[NOTIFY_ENV], env, ARRAY_SIZE(env)))
goto error;
- netifd_start_process((const char **) argv, (char **) env, proto_fd, &state->proto_task);
+ netifd_start_process((const char **) argv, (char **) env, &state->proto_task);
return 0;
@@ -469,8 +469,11 @@ proto_shell_attach(const struct proto_handler *h, struct interface *iface,
state->proto.cb = proto_shell_handler;
state->setup_timeout.cb = proto_shell_setup_timeout_cb;
state->setup_task.cb = proto_shell_setup_cb;
+ state->setup_task.dir_fd = proto_fd;
state->teardown_task.cb = proto_shell_teardown_cb;
+ state->teardown_task.dir_fd = proto_fd;
state->proto_task.cb = proto_shell_task_cb;
+ state->proto_task.dir_fd = proto_fd;
state->handler = container_of(h, struct proto_shell_handler, proto);
return &state->proto;