This commit is contained in:
Max Lv
2016-11-10 17:22:03 +08:00
parent cb0cc25fd9
commit 87b01a14d5
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -109,14 +109,14 @@ run_as(const char *user)
if (err == 0 && pwd) {
/* setgid first, because we may not be allowed to do it anymore after setuid */
if (setregid(pwd->pw_gid, 0) != 0) {
if (setgid(pwd->pw_gid) != 0) {
LOGE(
"Could not change group id to that of run_as user '%s': %s",
user, strerror(errno));
return 0;
}
if (setreuid(pwd->pw_uid, 0) != 0) {
if (setuid(pwd->pw_uid) != 0) {
LOGE(
"Could not change user id to that of run_as user '%s': %s",
user, strerror(errno));
@@ -150,12 +150,12 @@ run_as(const char *user)
return 0;
}
/* setgid first, because we may not allowed to do it anymore after setuid */
if (setregid(pwd->pw_gid, 0) != 0) {
if (setgid(pwd->pw_gid) != 0) {
LOGE("Could not change group id to that of run_as user '%s': %s",
user, strerror(errno));
return 0;
}
if (setreuid(pwd->pw_uid, 0) != 0) {
if (setuid(pwd->pw_uid) != 0) {
LOGE("Could not change user id to that of run_as user '%s': %s",
user, strerror(errno));
return 0;