summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-03-28 15:41:58 +0100
committerJohn Crispin <blogic@openwrt.org>2015-03-28 18:35:21 +0100
commit91da63d3d3fd680c805dd1a1b78df5b8731a8173 (patch)
treeec9a568a398ae536ccf7ac89a23942a60ef25c98 /service
parent74d835463e05e5761f6f5271e487f299f29d3f07 (diff)
downloadunitd-91da63d3d3fd680c805dd1a1b78df5b8731a8173.tar
unitd-91da63d3d3fd680c805dd1a1b78df5b8731a8173.zip
properly handle return codes
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'service')
-rw-r--r--service/instance.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/service/instance.c b/service/instance.c
index 8d2001a..f5b61fa 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -283,8 +283,10 @@ instance_run(struct service_instance *in, int _stdout, int _stderr)
}
if (in->uid || in->gid) {
- setuid(in->uid);
- setgid(in->gid);
+ if (setuid(in->uid) || setgid(in->gid)) {
+ ERROR("failed to set uid:%d, gid:%d\n", in->uid, in->gid);
+ exit(127);
+ }
}
execvp(argv[0], argv);
exit(127);