summary refs log tree commit diff stats
path: root/os-posix.c
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2018-04-16 15:16:23 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2018-04-26 16:29:51 +0100
commita7aaec148e27193cc6f7d33d2f18f81eed011a5c (patch)
treea514b0e1831517953f223823e16fe3edbafcf0f1 /os-posix.c
parent22cd4f4835b2053271e737b1679927b9b8aa4252 (diff)
downloadfocaccia-qemu-a7aaec148e27193cc6f7d33d2f18f81eed011a5c.tar.gz
focaccia-qemu-a7aaec148e27193cc6f7d33d2f18f81eed011a5c.zip
os-posix: cleanup: Replace perror with error_report
perror() is defined to fprintf(stderr,...).  HACKING says
fprintf(stderr,...) is wrong.  So perror() is too.

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>
CC: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/os-posix.c b/os-posix.c
index a2ba50d23f..24eb7007dc 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -125,7 +125,7 @@ void os_set_proc_name(const char *s)
     /* Could rewrite argv[0] too, but that's a bit more complicated.
        This simple way is enough for `top'. */
     if (prctl(PR_SET_NAME, name)) {
-        perror("unable to change process name");
+        error_report("unable to change process name: %s", strerror(errno));
         exit(1);
     }
 #else
@@ -247,7 +247,7 @@ static void change_root(void)
             exit(1);
         }
         if (chdir("/")) {
-            perror("not able to chdir to /");
+            error_report("not able to chdir to /: %s", strerror(errno));
             exit(1);
         }
     }
@@ -309,7 +309,7 @@ void os_setup_post(void)
 
     if (daemonize) {
         if (chdir("/")) {
-            perror("not able to chdir to /");
+            error_report("not able to chdir to /: %s", strerror(errno));
             exit(1);
         }
         TFR(fd = qemu_open("/dev/null", O_RDWR));
@@ -383,7 +383,7 @@ int os_mlock(void)
 
     ret = mlockall(MCL_CURRENT | MCL_FUTURE);
     if (ret < 0) {
-        perror("mlockall");
+        error_report("mlockall: %s", strerror(errno));
     }
 
     return ret;