Index: hdparm-9.43/sgio.c =================================================================== --- hdparm-9.43.orig/sgio.c +++ hdparm-9.43/sgio.c @@ -17,6 +17,10 @@ #include +#ifndef DEMAND_SENSE_DATA + #define DEMAND_SENSE_DATA 0 +#endif + extern int verbose; extern int prefer_ata12; @@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc unsigned char cdb[SG_ATA_16_LEN]; unsigned char sb[32], *desc; struct scsi_sg_io_hdr io_hdr; - int prefer12 = prefer_ata12, demanded_sense = 0; + int prefer12 = prefer_ata12; if (tf->command == ATA_OP_PIDENTIFY) prefer12 = 0; @@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc desc = sb + 8; if (io_hdr.driver_status != SG_DRIVER_SENSE) { - if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { - static int second_try = 0; - if (!second_try++) + static int second_try = 0; + if (!second_try++) { + if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n"); - } else if (demanded_sense) { - static int second_try = 0; - if (!second_try++) + } +#if DEMAND_SENSE_DATA + else { fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n"); + } +#endif } } else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) { dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));