mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-15 06:01:58 -06:00
os-posix: cleanup: Replace fprintfs with error_report in change_process_uid
I'm going to be editing this function and it makes sense to clean up this style problem in advance. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Markus Armbruster <armbru@redhat.com> CC: Daniel P. Berrange <berrange@redhat.com> CC: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
6b47c2aa78
commit
f0a2171bf9
1 changed files with 5 additions and 5 deletions
10
os-posix.c
10
os-posix.c
|
@ -167,20 +167,20 @@ static void change_process_uid(void)
|
||||||
{
|
{
|
||||||
if (user_pwd) {
|
if (user_pwd) {
|
||||||
if (setgid(user_pwd->pw_gid) < 0) {
|
if (setgid(user_pwd->pw_gid) < 0) {
|
||||||
fprintf(stderr, "Failed to setgid(%d)\n", user_pwd->pw_gid);
|
error_report("Failed to setgid(%d)", user_pwd->pw_gid);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (initgroups(user_pwd->pw_name, user_pwd->pw_gid) < 0) {
|
if (initgroups(user_pwd->pw_name, user_pwd->pw_gid) < 0) {
|
||||||
fprintf(stderr, "Failed to initgroups(\"%s\", %d)\n",
|
error_report("Failed to initgroups(\"%s\", %d)",
|
||||||
user_pwd->pw_name, user_pwd->pw_gid);
|
user_pwd->pw_name, user_pwd->pw_gid);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (setuid(user_pwd->pw_uid) < 0) {
|
if (setuid(user_pwd->pw_uid) < 0) {
|
||||||
fprintf(stderr, "Failed to setuid(%d)\n", user_pwd->pw_uid);
|
error_report("Failed to setuid(%d)", user_pwd->pw_uid);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (setuid(0) != -1) {
|
if (setuid(0) != -1) {
|
||||||
fprintf(stderr, "Dropping privileges failed\n");
|
error_report("Dropping privileges failed");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue