From 91da63d3d3fd680c805dd1a1b78df5b8731a8173 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 28 Mar 2015 15:41:58 +0100 Subject: properly handle return codes Signed-off-by: John Crispin --- service/instance.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'service') 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); -- cgit v1.2.3