summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-02-09 12:49:19 +0100
committerKay Sievers <kay.sievers@vrfy.org>2011-02-09 22:12:15 +0100
commit46df5b1baeb806f840d44fe06e0d71e335a5aebf (patch)
tree80a57d70baa423e84f87ef02e5f02ff7b7339e36
parent54453a95102ddc3fcb88dbcf5713710db94a5ab5 (diff)
ata_id: do not print empty serial numbers to avoid unwanted trailing '_'
-rw-r--r--extras/ata_id/ata_id.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c
index 92387e5077..594cfb2017 100644
--- a/extras/ata_id/ata_id.c
+++ b/extras/ata_id/ata_id.c
@@ -584,8 +584,12 @@ int main(int argc, char *argv[])
printf("ID_MODEL=%s\n", model);
printf("ID_MODEL_ENC=%s\n", model_enc);
printf("ID_REVISION=%s\n", revision);
- printf("ID_SERIAL=%s_%s\n", model, serial);
- printf("ID_SERIAL_SHORT=%s\n", serial);
+ if (serial[0] != '\0') {
+ printf("ID_SERIAL=%s_%s\n", model, serial);
+ printf("ID_SERIAL_SHORT=%s\n", serial);
+ } else {
+ printf("ID_SERIAL=%s\n", model);
+ }
if (id.command_set_1 & (1<<5)) {
printf ("ID_ATA_WRITE_CACHE=1\n");