]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: fix -l
authorKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 15:04:57 +0000 (17:04 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 15:04:57 +0000 (17:04 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.c
libfdisk/src/label.c

index 8bd6c4edb094e925142ac4dd2c8b2835e0c7884a..368c89ed087ff60292d6cb2d5e1881510a1ee342 100644 (file)
@@ -348,13 +348,18 @@ static void print_all_devices_pt(struct fdisk_context *cxt)
                return;
        }
 
+       DBG(FRONTEND, dbgprint("reading "_PATH_PROC_PARTITIONS));
+
        while (fgets(line, sizeof(line), f)) {
                char ptname[128 + 1], devname[256];
 
-               if (sscanf(line, " %*d %*d %*d %128[^\n ]", ptname) != 4)
+               if (sscanf(line, " %*d %*d %*d %128[^\n ]", ptname) != 1)
                        continue;
 
                snprintf(devname, sizeof(devname), "/dev/%s", ptname);
+
+               DBG(FRONTEND, dbgprint("listing %s", devname));
+
                if (is_whole_disk(devname)) {
                        char *cn = canonicalize_path(devname);
                        if (cn) {
index 95a0abfb95ba9aa8620928b58c6e8dca989ccac4..aba2790cc870184902dbee64fa2802f20fb96bbd 100644 (file)
@@ -83,9 +83,9 @@ int fdisk_write_disklabel(struct fdisk_context *cxt)
 int fdisk_require_geometry(struct fdisk_context *cxt)
 {
        assert(cxt);
-       assert(cxt->label);
 
-       return cxt->label->flags & FDISK_LABEL_FL_REQUIRE_GEOMETRY ? 1 : 0;
+       return cxt->label
+              && cxt->label->flags & FDISK_LABEL_FL_REQUIRE_GEOMETRY ? 1 : 0;
 }
 
 int fdisk_missing_geometry(struct fdisk_context *cxt)
@@ -93,7 +93,6 @@ int fdisk_missing_geometry(struct fdisk_context *cxt)
        int rc;
 
        assert(cxt);
-       assert(cxt->label);
 
        rc = (fdisk_require_geometry(cxt) &&
                    (!cxt->geom.heads || !cxt->geom.sectors