about summary refs log tree commit diff
path: root/Src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/options.c')
-rw-r--r--Src/options.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Src/options.c b/Src/options.c
index 6e4e7b911..3e3e07474 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -766,7 +766,17 @@ dosetopt(int optno, int value, int force, char *new_opts)
 #ifdef HAVE_SETUID
 	setuid(getuid());
 	setgid(getgid());
-#endif /* HAVE_SETUID */
+        if (setuid(getuid())) {
+            zwarn("failed to change user ID: %e", errno);
+            return -1;
+	} else if (setgid(getgid())) {
+            zwarn("failed to change group ID: %e", errno);
+            return -1;
+        }
+#else
+        zwarn("setuid not available");
+        return -1;
+#endif /* not HAVE_SETUID */
 #ifdef JOB_CONTROL
     } else if (!force && optno == MONITOR && value) {
 	if (new_opts[optno] == value)