diff options
author | Rob Landley <rob@landley.net> | 2017-10-31 15:43:38 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2017-10-31 15:43:38 -0500 |
commit | b2d8cf906502226904e149e20279a899ba22e035 (patch) | |
tree | 746dc54b2ffbafa933e2d68bd9417861345c4b6a | |
parent | 2d893a4077c12732238f5a9fc9c31fda8bcc3ed9 (diff) | |
download | toybox-b2d8cf906502226904e149e20279a899ba22e035.tar.gz |
Only show LABEL= when there is one.
-rwxr-xr-x | tests/blkid.test | 2 | ||||
-rw-r--r-- | toys/other/blkid.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/blkid.test b/tests/blkid.test index d3bf6a1f..deb94d89 100755 --- a/tests/blkid.test +++ b/tests/blkid.test @@ -22,7 +22,7 @@ testing "ext4" 'bzcat "$BDIR"/ext4.bz2 | blkid -' \ '-: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \ "" "" testing "f2fs" 'bzcat "$BDIR"/f2fs.bz2 | blkid -' \ - '-: LABEL="" UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \ + '-: UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \ "" "" testing "msdos" 'bzcat "$BDIR"/msdos.bz2 | blkid -' \ '-: LABEL="mymsdos" UUID="5108-1e6e" TYPE="vfat"\n' "" "" diff --git a/toys/other/blkid.c b/toys/other/blkid.c index 04c9b5f0..ee3564cf 100644 --- a/toys/other/blkid.c +++ b/toys/other/blkid.c @@ -116,14 +116,14 @@ static void do_blkid(int fd, char *name) printf("%s:",name); if (fstypes[i].label_len) { - char *s = toybuf+fstypes[i].label_off-off;; + char *s = toybuf+fstypes[i].label_off-off; len = fstypes[i].label_len; if (!strcmp(type, "vfat")) { while (len && s[len-1]==' ') len--; if (strstart(&s, "NO NAME")) len=0; } - if (len) printf(" LABEL=\"%.*s\"", len, s); + if (len && *s) printf(" LABEL=\"%.*s\"", len, s); } if (fstypes[i].uuid_off) { |