]> git.ipfire.org Git - thirdparty/libatasmart.git/commitdiff
handle the good status of bad sector attributes especially
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Mar 2009 00:19:21 +0000 (01:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Mar 2009 00:19:21 +0000 (01:19 +0100)
atasmart.c

index 8580a4c04630f0f6cbcd848d4e0d10403f2e1313..743ecaa4666d56abcd7f811a3cf4b3e184e7c662 100644 (file)
@@ -1331,6 +1331,16 @@ int sk_disk_smart_parse_attributes(SkDisk *d, SkSmartAttributeParseCallback cb,
 
                 find_threshold(d, &a);
 
+                /* Handle a few fields specially */
+                if ((!strcmp(a.name, "reallocated-sector-count") ||
+                     !strcmp(a.name, "reallocated-event-count") ||
+                     !strcmp(a.name, "current-pending-sector")) &&
+                    a.pretty_unit == SK_SMART_ATTRIBUTE_UNIT_SECTORS &&
+                    a.pretty_value > 0) {
+                        a.good = FALSE;
+                        a.good_valid = TRUE;
+                }
+
                 cb(d, &a, userdata);
 
                 free(an);