From d24e5ca0a9234ad1bad85582e5f07991e44a378d Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Thu, 12 Dec 2002 13:55:54 +0000 Subject: [PATCH] Cleaned up with strerror() git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@373 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/atacmds.c | 9 +++------ sm5/atacmds.cpp | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/sm5/atacmds.c b/sm5/atacmds.c index 8ee0135ff..2f4110459 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -29,7 +29,7 @@ #include <stdlib.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.c,v 1.45 2002/12/12 13:42:59 ballen4705 Exp $" CVSID1; +const char *CVSid1="$Id: atacmds.c,v 1.46 2002/12/12 13:55:54 ballen4705 Exp $" CVSID1; // These Drive Identity tables are taken from hdparm 5.2, and are also // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note @@ -120,12 +120,9 @@ const int actual_ver[] = { // printing. void syserror(const char *message){ const char *errormessage; - + // Get the correct system error message: - if (errno<sys_nerr) - errormessage=sys_errlist[errno]; - else - errormessage="unrecognized system error"; + errormessage=strerror(errno); // Check that caller has handed a sensible string, and provide // appropriate output. See perrror(3) man page to understand better. diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 47b333e10..48e5b6de0 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -29,7 +29,7 @@ #include <stdlib.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.cpp,v 1.45 2002/12/12 13:42:59 ballen4705 Exp $" CVSID1; +const char *CVSid1="$Id: atacmds.cpp,v 1.46 2002/12/12 13:55:54 ballen4705 Exp $" CVSID1; // These Drive Identity tables are taken from hdparm 5.2, and are also // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note @@ -120,12 +120,9 @@ const int actual_ver[] = { // printing. void syserror(const char *message){ const char *errormessage; - + // Get the correct system error message: - if (errno<sys_nerr) - errormessage=sys_errlist[errno]; - else - errormessage="unrecognized system error"; + errormessage=strerror(errno); // Check that caller has handed a sensible string, and provide // appropriate output. See perrror(3) man page to understand better. -- GitLab