Skip to content
Snippets Groups Projects
Commit d8a6ba17 authored by dpgilbert's avatar dpgilbert
Browse files

clean up last entry when truncation of BMS results log

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2268 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent edbe2c09
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define GBUF_SIZE 65535 #define GBUF_SIZE 65535
const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.115 2006/09/14 04:43:21 dpgilbert Exp $" const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.116 2006/09/25 03:57:01 dpgilbert Exp $"
CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID; CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// control block which points to external global control variables // control block which points to external global control variables
...@@ -858,7 +858,8 @@ static int scsiPrintBackgroundResults(int device) ...@@ -858,7 +858,8 @@ static int scsiPrintBackgroundResults(int device)
num = (gBuf[2] << 8) + gBuf[3] + 4; num = (gBuf[2] << 8) + gBuf[3] + 4;
if (num < 20) { if (num < 20) {
PRINT_ON(con); PRINT_ON(con);
pout("Background results Log Sense length is %d, no scan status\n", num); pout("Background results Log Sense length is %d, no scan status\n",
num);
PRINT_OFF(con); PRINT_OFF(con);
return FAILSMART; return FAILSMART;
} }
...@@ -878,8 +879,10 @@ static int scsiPrintBackgroundResults(int device) ...@@ -878,8 +879,10 @@ static int scsiPrintBackgroundResults(int device)
pout("\nBackground scan results log\n"); pout("\nBackground scan results log\n");
} }
pout(" Status: "); pout(" Status: ");
if (pl < 16) if ((pl < 16) || (num < 16)) {
pout("\n");
break; break;
}
j = ucp[9]; j = ucp[9];
if (j < (int)(sizeof(bms_status) / sizeof(bms_status[0]))) if (j < (int)(sizeof(bms_status) / sizeof(bms_status[0])))
pout("%s\n", bms_status[j]); pout("%s\n", bms_status[j]);
...@@ -904,7 +907,8 @@ static int scsiPrintBackgroundResults(int device) ...@@ -904,7 +907,8 @@ static int scsiPrintBackgroundResults(int device)
"reassign_status\n"); "reassign_status\n");
} }
pout(" %3d ", pc); pout(" %3d ", pc);
if (pl < 24) { if ((pl < 24) || (num < 24)) {
if (pl < 24)
pout("parameter length >= 24 expected, got %d\n", pl); pout("parameter length >= 24 expected, got %d\n", pl);
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment