]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: fix compiler warnings about uninitialized variables
authorSami Kerola <kerolasa@iki.fi>
Wed, 15 Oct 2014 21:19:28 +0000 (22:19 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Oct 2014 12:07:21 +0000 (14:07 +0200)
warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/sfdisk.c

index ad0e17e2126501b43fe2dbf1e1ce81f5c5d13373..49369bd0e9ac7896f45649c2a6b13a4690de8304 100644 (file)
@@ -756,7 +756,7 @@ static int command_partuuid(struct sfdisk *sf, int argc, char **argv)
 
        /* print partition uuid */
        if (!uuid) {
-               const char *str;
+               const char *str = NULL;
 
                if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
                        str = fdisk_partition_get_uuid(pa);
@@ -811,7 +811,7 @@ static int command_partlabel(struct sfdisk *sf, int argc, char **argv)
 
        /* print partition name */
        if (!name) {
-               const char *str;
+               const char *str = NULL;
 
                if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
                        str = fdisk_partition_get_name(pa);
@@ -867,7 +867,7 @@ static int command_partattrs(struct sfdisk *sf, int argc, char **argv)
 
        /* print partition name */
        if (!attrs) {
-               const char *str;
+               const char *str = NULL;
 
                if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
                        str = fdisk_partition_get_attrs(pa);