chiark / gitweb /
ata_id: check for empty serial number
authorKay Sievers <kay.sievers@suse.de>
Tue, 12 Jul 2005 09:41:09 +0000 (11:41 +0200)
committerKay Sievers <kay.sievers@suse.de>
Tue, 12 Jul 2005 09:41:09 +0000 (11:41 +0200)
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
extras/ata_id/ata_id.c

index 34b1ccd..54c3c29 100644 (file)
@@ -167,8 +167,12 @@ int main(int argc, char *argv[])
                printf("ID_MODEL=%s\n", model);
                printf("ID_SERIAL=%s\n", serial);
                printf("ID_REVISION=%s\n", revision);
-       } else
-               printf("%s_%s\n", model, serial);
+       } else {
+               if (serial[0] != '\0')
+                       printf("%s_%s\n", model, serial);
+               else
+                       printf("%s\n", model);
+       }
 
 close:
        close(fd);