From d62c38a106b966a097ff8bfa22f490ee81fc03e9 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Wed, 23 Oct 2002 13:43:42 +0000 Subject: [PATCH] Fixed erroneous error message when doing non-captive self-tests. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@91 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/atacmds.c | 4 ++-- sm5/atacmds.cpp | 4 ++-- sm5/ataprint.c | 9 ++------- sm5/ataprint.cpp | 9 ++------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/sm5/atacmds.c b/sm5/atacmds.c index 52706b833..f4dbd8e41 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -30,7 +30,7 @@ #include <errno.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.c,v 1.19 2002/10/23 12:24:24 ballen4705 Exp $\n" "\t" CVSID1 ; +const char *CVSid1="$Id: atacmds.c,v 1.20 2002/10/23 13:43:42 ballen4705 Exp $\n" "\t" 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 @@ -561,7 +561,7 @@ int ataSmartTest(int device, int testtype){ // Now send the command to test errornum=ioctl(device, HDIO_DRIVE_CMD, parms); - if (!(errornum && errno==EIO && (testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST))){ + if (errornum && !((testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST) && errno==EIO)){ char errormsg[128]; sprintf(errormsg,"Command \"%s\" failed",cmdmsg); perror(errormsg); diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index 98eabac4d..faee25e67 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -30,7 +30,7 @@ #include <errno.h> #include "atacmds.h" -const char *CVSid1="$Id: atacmds.cpp,v 1.19 2002/10/23 12:24:24 ballen4705 Exp $\n" "\t" CVSID1 ; +const char *CVSid1="$Id: atacmds.cpp,v 1.20 2002/10/23 13:43:42 ballen4705 Exp $\n" "\t" 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 @@ -561,7 +561,7 @@ int ataSmartTest(int device, int testtype){ // Now send the command to test errornum=ioctl(device, HDIO_DRIVE_CMD, parms); - if (!(errornum && errno==EIO && (testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST))){ + if (errornum && !((testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST) && errno==EIO)){ char errormsg[128]; sprintf(errormsg,"Command \"%s\" failed",cmdmsg); perror(errormsg); diff --git a/sm5/ataprint.c b/sm5/ataprint.c index bb0cb8c8f..0c3e8120c 100644 --- a/sm5/ataprint.c +++ b/sm5/ataprint.c @@ -28,7 +28,7 @@ #include "smartctl.h" #include "extern.h" -const char *CVSid4="$Id: ataprint.c,v 1.26 2002/10/23 12:37:11 ballen4705 Exp $\n" +const char *CVSid4="$Id: ataprint.c,v 1.27 2002/10/23 13:43:42 ballen4705 Exp $\n" "\t" CVSID2 "\t" CVSID3 "\t" CVSID6 ; // Function for printing ASCII byte-swapped strings, skipping white @@ -665,12 +665,7 @@ int ataPrintSmartSelfTestlog (struct ata_smart_selftestlog data,int allentries){ pout("#%2d %s %s %s %8u %s\n",21-i,msgtest,msgstat, percent,log->timestamp,firstlba); } - else { - pout("\n"); - return retval; - } } - pout("\n"); return retval; } @@ -1021,6 +1016,7 @@ int ataPrintMain (int fd){ if (ataPrintSmartSelfTestlog(smartselftest,!quietmode)) returnval|=FAILLOG; QUIETOFF; + pout("\n"); } } } @@ -1030,7 +1026,6 @@ int ataPrintMain (int fd){ return returnval; pout("=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===\n"); - // if doing a self-test, be sure it's supported by the hardware if (testcase==OFFLINE_FULL_SCAN && !isSupportExecuteOfflineImmediate(smartval)) pout("Warning: device does not support Execute Off-Line Immediate function.\n\n"); diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp index a74532613..e3ad6135e 100644 --- a/sm5/ataprint.cpp +++ b/sm5/ataprint.cpp @@ -28,7 +28,7 @@ #include "smartctl.h" #include "extern.h" -const char *CVSid4="$Id: ataprint.cpp,v 1.26 2002/10/23 12:37:11 ballen4705 Exp $\n" +const char *CVSid4="$Id: ataprint.cpp,v 1.27 2002/10/23 13:43:42 ballen4705 Exp $\n" "\t" CVSID2 "\t" CVSID3 "\t" CVSID6 ; // Function for printing ASCII byte-swapped strings, skipping white @@ -665,12 +665,7 @@ int ataPrintSmartSelfTestlog (struct ata_smart_selftestlog data,int allentries){ pout("#%2d %s %s %s %8u %s\n",21-i,msgtest,msgstat, percent,log->timestamp,firstlba); } - else { - pout("\n"); - return retval; - } } - pout("\n"); return retval; } @@ -1021,6 +1016,7 @@ int ataPrintMain (int fd){ if (ataPrintSmartSelfTestlog(smartselftest,!quietmode)) returnval|=FAILLOG; QUIETOFF; + pout("\n"); } } } @@ -1030,7 +1026,6 @@ int ataPrintMain (int fd){ return returnval; pout("=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===\n"); - // if doing a self-test, be sure it's supported by the hardware if (testcase==OFFLINE_FULL_SCAN && !isSupportExecuteOfflineImmediate(smartval)) pout("Warning: device does not support Execute Off-Line Immediate function.\n\n"); -- GitLab