This commit is contained in:
Owen Rafferty 2022-04-05 14:57:02 -05:00
parent 6259c5f5d3
commit 0679c76778
No known key found for this signature in database
GPG Key ID: A68B10E2554DEBCB

9
dwl.c
View File

@ -1122,16 +1122,13 @@ drop_permissions(void)
{ {
if (getuid() != geteuid() || getgid() != getegid()) { if (getuid() != geteuid() || getgid() != getegid()) {
/* Set the gid and uid in the correct order. */ /* Set the gid and uid in the correct order. */
if (setgid(getgid()) != 0) { if (setgid(getgid()) != 0)
die("Unable to drop root group, refusing to start"); die("Unable to drop root group, refusing to start");
} if (setuid(getuid()) != 0)
if (setuid(getuid()) != 0) {
die("Unable to drop root user, refusing to start"); die("Unable to drop root user, refusing to start");
}
} }
if (setgid(0) != -1 || setuid(0) != -1) { if (setgid(0) != -1 || setuid(0) != -1)
die("Unable to drop root, refusing to start"); die("Unable to drop root, refusing to start");
}
} }
void void