]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swapon: don't use empty strings for smartcols output
authorKarel Zak <kzak@redhat.com>
Tue, 22 Jul 2014 10:24:56 +0000 (12:24 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 22 Jul 2014 10:24:56 +0000 (12:24 +0200)
The libsmartcols is smart enough to accept NULL for empty fields
rather than empty strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/swapon.c

index 0c8ca03e147bf9839fedddb8bc27f7a511d685ac..02cad024a51d11d934804e6ecefe658f894b7648 100644 (file)
@@ -199,17 +199,13 @@ static void add_scols_line(struct libscols_table *table, struct libmnt_fs *fs, i
                case COL_UUID:
                        if (pr && !blkid_probe_lookup_value(pr, "UUID", &data, NULL))
                                xasprintf(&str, "%s", data);
-                       else if (pr)
-                               xasprintf(&str, "");
-                       else
+                       else if (!pr)
                                xasprintf(&str, _("read failed"));
                        break;
                case COL_LABEL:
                        if (pr && !blkid_probe_lookup_value(pr, "LABEL", &data, NULL))
                                xasprintf(&str, "%s", data);
-                       else if (pr)
-                               xasprintf(&str, "");
-                       else
+                       else if (!pr)
                                xasprintf(&str, _("read failed"));
                        break;
                default: