[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] Do not generate spurious error for -runas root
From: |
Chris Webb |
Subject: |
[Qemu-devel] [PATCH 1/2] Do not generate spurious error for -runas root |
Date: |
Thu, 24 Nov 2011 16:29:48 +0000 |
change_process_uid() checks that privileges have been successfully dropped by
verifying that setuid(0) fails. However, if qemu is explicitly -runas root,
the setuid(0) would correctly succeed, so we skip the test in that case.
Signed-off-by: Chris Webb <address@hidden>
---
os-posix.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/os-posix.c b/os-posix.c
index dc4a6bb..1b2061a 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -209,7 +209,7 @@ static void change_process_uid(void)
fprintf(stderr, "Failed to setuid(%d)\n", user_pwd->pw_uid);
exit(1);
}
- if (setuid(0) != -1) {
+ if (user_pwd->pw_uid != 0 && setuid(0) != -1) {
fprintf(stderr, "Dropping privileges failed\n");
exit(1);
}
--
1.7.5.4
- [Qemu-devel] [PATCH 1/2] Do not generate spurious error for -runas root,
Chris Webb <=