crash-pipe: print symbolic information about errors 16/65816/1
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 12 Apr 2016 16:08:26 +0000 (18:08 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 12 Apr 2016 16:11:07 +0000 (18:11 +0200)
This commit brings back symbolic errors removed by commit
81321af5a ("common: remove thread unsafe function") which
eliminated strerror() usage.

Change-Id: I92ed531865dfb8a01f1f00aec32b418a9f4e4f33

src/crash-pipe/crash-pipe.c

index a0b899ac82286d438f3aec5f9fa7ab556cedbf37..e0016b70ead227dc33c27e0e9fa0570dd109f009 100644 (file)
@@ -181,8 +181,7 @@ static int save_core(const char *core_path)
 
      fd = open(core_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
      if (fd == -1) {
-         syslog(LOG_ERR, "crash-pipe: Unable to save core file to %s: (%d)\n",
-                core_path, errno);
+         syslog(LOG_ERR, "crash-pipe: Unable to save core file to %s: %m\n", core_path);
          return -1;
      }
 
@@ -192,8 +191,7 @@ static int save_core(const char *core_path)
          for (n = 0, remaining = readb ; remaining > 0; remaining -= n) {
               n = write(fd, buf, remaining);
               if (n == -1) {
-                   syslog(LOG_ERR, "crash-pipe: Error while saving core file %s: %d. Removing core.\n",
-                          core_path, errno);
+                   syslog(LOG_ERR, "crash-pipe: Error while saving core file %s: %m. Removing core.\n", core_path);
                    (void)unlink(core_path); // XXX check errors here too
                    goto out;
               }