diff -Nur ../hitch-hitch-1.0.0-beta3.orig/src/hitch.c ./src/hitch.c
--- ../hitch-hitch-1.0.0-beta3.orig/src/hitch.c 2015-06-18 12:01:42.000000000 +0200
+++ ./src/hitch.c 2015-06-22 23:53:22.790991923 +0200
@@ -46,10 +46,10 @@
#include <errno.h>
#include <getopt.h>
#include <pwd.h>
-#include <grp.h>
#include <limits.h>
#include <syslog.h>
#include <stdarg.h>
+#include <grp.h>
#include <ctype.h>
#include <sched.h>
@@ -2026,8 +2026,10 @@
}
void drop_privileges() {
- if (CONFIG->GID >= 0 && setgroups(0, NULL) < 0 && setgid(CONFIG->GID) < 0)
- fail("setgroups or setgid failed");
+ if (CONFIG->UID >= 0 && setgroups(0, NULL) < 0)
+ fail("setgroups failed");
+ if (CONFIG->GID >= 0 && setgid(CONFIG->GID) < 0)
+ fail("setgid failed");
if (CONFIG->UID >= 0 && setuid(CONFIG->UID) < 0)
fail("setuid failed");
}