]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: make fdisk_partname() more robust
authorKarel Zak <kzak@redhat.com>
Thu, 13 Aug 2020 08:12:01 +0000 (10:12 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 13 Aug 2020 08:12:01 +0000 (10:12 +0200)
libfdisk/src/utils.c

index 6056e7f1fe41c0b5ac72a48d97fa05929910d3ea..38ad233933af60ee8a3fce6b828cb08cf914110e 100644 (file)
@@ -142,7 +142,7 @@ char *fdisk_partname(const char *dev, size_t partno)
 
        /* devfs kludge - note: fdisk partition names are not supposed
           to equal kernel names, so there is no reason to do this */
-       if (strcmp(dev + w - 4, "disc") == 0) {
+       if (endswith(dev, "disc")) {
                w -= 4;
                p = "part";
        }