diff --git a/sm5/atacmds.c b/sm5/atacmds.c
index 36b5a598fe2f57547814f6a3e12c20580d342ba2..fb672d84ad7a9e663103e0c0dadae778fab12beb 100644
--- a/sm5/atacmds.c
+++ b/sm5/atacmds.c
@@ -1,4 +1,4 @@
-//  $Id: atacmds.c,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $
+//  $Id: atacmds.c,v 1.14 2002/10/21 16:11:58 ballen4705 Exp $
 /*
  * atacmds.c
  * 
@@ -549,7 +549,8 @@ int ataSmartTest(int device, int testtype){
   printf("Sending command: \"%s\".\n",cmdmsg);
 
   // Now send the command to test
-  if ((errornum=ioctl(device , HDIO_DRIVE_CMD, parms)) && errornum!=EIO){
+  errornum=ioctl(device, HDIO_DRIVE_CMD, parms);
+  if (!(errornum && errno==EIO && (testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST))){
     char errormsg[128];
     sprintf(errormsg,"Command \"%s\" failed.",cmdmsg); 
     perror (errormsg);
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 7e9dccd4423e05b8a921c665f6391b217d3f855c..5c0ee3d28869839590569c65b8da7552a751f84b 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -1,4 +1,4 @@
-//  $Id: atacmds.cpp,v 1.13 2002/10/21 16:00:47 ballen4705 Exp $
+//  $Id: atacmds.cpp,v 1.14 2002/10/21 16:11:58 ballen4705 Exp $
 /*
  * atacmds.c
  * 
@@ -549,7 +549,8 @@ int ataSmartTest(int device, int testtype){
   printf("Sending command: \"%s\".\n",cmdmsg);
 
   // Now send the command to test
-  if ((errornum=ioctl(device , HDIO_DRIVE_CMD, parms)) && errornum!=EIO){
+  errornum=ioctl(device, HDIO_DRIVE_CMD, parms);
+  if (!(errornum && errno==EIO && (testtype=SHORT_CAPTIVE_SELF_TEST || testtype==EXTEND_CAPTIVE_SELF_TEST))){
     char errormsg[128];
     sprintf(errormsg,"Command \"%s\" failed.",cmdmsg); 
     perror (errormsg);