[OpenWrt-Devel] [PATCH 1/2] Provide meaningful error messages when fork fails.
Juliusz Chroboczek
jch at pps.univ-paris-diderot.fr
Thu Jun 25 18:23:32 EDT 2015
---
inittab.c | 6 +++---
rcS.c | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/inittab.c b/inittab.c
index eb402f8..2767e17 100644
--- a/inittab.c
+++ b/inittab.c
@@ -116,13 +116,13 @@ static void fork_worker(struct init_action *a)
execvp(a->argv[0], a->argv);
ERROR("Failed to execute %s\n", a->argv[0]);
exit(-1);
- }
-
- if (a->proc.pid > 0) {
+ } if (a->proc.pid > 0) {
DEBUG(4, "Launched new %s action, pid=%d\n",
a->handler->name,
(int) a->proc.pid);
uloop_process_add(&a->proc);
+ } else {
+ ERROR("Failed to create process for %s\n", a->argv[0]);
}
}
diff --git a/rcS.c b/rcS.c
index 8c72c19..1e8b676 100644
--- a/rcS.c
+++ b/rcS.c
@@ -75,8 +75,10 @@ static void q_initd_run(struct runqueue *q, struct runqueue_task *t)
}
pid = fork();
- if (pid < 0)
+ if (pid < 0) {
+ ERROR("Failed to create process.\n");
return;
+ }
if (pid) {
close(pipefd[1]);
--
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list