diff --git a/cmdline/device.c b/cmdline/device.c index e8c36465..0b03d1b2 100644 --- a/cmdline/device.c +++ b/cmdline/device.c @@ -395,8 +395,8 @@ static void state_smart(int verbose, unsigned n, tommy_list* low) printf("%8" PRIu64, devinfo->smart[SMART_ERROR]); else if (flag & (SMARTCTL_FLAG_ERROR | SMARTCTL_FLAG_ERROR_LOGGED)) printf(" ERROR"); - else if (flag & (SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) - printf(" n/a"); + else if (flag & (SMARTCTL_FLAG_UNSUPPORTED | SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) + printf(" -"); else if (devinfo->smart[SMART_ERROR] == 0) printf(" 0"); else @@ -406,7 +406,7 @@ static void state_smart(int verbose, unsigned n, tommy_list* low) if (flag & (SMARTCTL_FLAG_FAIL | SMARTCTL_FLAG_PREFAIL | SMARTCTL_FLAG_PREFAIL_LOGGED)) make_it_fail = 1; - if (flag & (SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) { + if (flag & (SMARTCTL_FLAG_UNSUPPORTED | SMARTCTL_FLAG_OPEN | SMARTCTL_FLAG_COMMAND)) { /* if error running smartctl, skip AFR estimation */ afr = 0; printf(" -"); diff --git a/cmdline/mingw.c b/cmdline/mingw.c index 35de77e5..3cd99fc9 100644 --- a/cmdline/mingw.c +++ b/cmdline/mingw.c @@ -1849,13 +1849,6 @@ static int devsmart(const char* file, uint64_t* smart, char* serial) return -1; /* LCOV_EXCL_STOP */ } - /* check only first bit, as other bits are used to report other conditions */ - if ((ret & 1) != 0) { - /* LCOV_EXCL_START */ - fprintf(stderr, "Failed to run smartctl -a on device '%s' with return code %xh.\n", file, ret); - return -1; - /* LCOV_EXCL_STOP */ - } /* store the return smartctl return value */ smart[SMART_FLAGS] = ret; diff --git a/cmdline/portable.h b/cmdline/portable.h index 2a2b67f6..7752a85f 100644 --- a/cmdline/portable.h +++ b/cmdline/portable.h @@ -328,6 +328,7 @@ int randomize(void* ptr, size_t size); /** * Flags returned by smartctl. */ +#define SMARTCTL_FLAG_UNSUPPORTED (1 << 0) /**< Device not recognized, requiring the -d option. */ #define SMARTCTL_FLAG_OPEN (1 << 1) /**< Device open failed. */ #define SMARTCTL_FLAG_COMMAND (1 << 2) /**< Some SMART or other ATA command to the disk failed. */ #define SMARTCTL_FLAG_FAIL (1 << 3) /**< SMART status check returned "DISK FAILING". */ diff --git a/cmdline/unix.c b/cmdline/unix.c index 2d6e07fa..36681874 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -655,13 +655,6 @@ static int devsmart(dev_t device, uint64_t* smart, char* serial) return -1; /* LCOV_EXCL_STOP */ } - /* check only first bit, as other bits are used to report other conditions */ - if ((WEXITSTATUS(ret) & 1) != 0) { - /* LCOV_EXCL_START */ - fprintf(stderr, "Failed to run smartctl -a on device '%u:%u' with return code %xh.\n", major(device), minor(device), WEXITSTATUS(ret)); - return -1; - /* LCOV_EXCL_STOP */ - } /* store the return smartctl return value */ smart[SMART_FLAGS] = WEXITSTATUS(ret);