[PATCH 4/4] sfdisk: fix compiler warnings about uninitialized variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 disk-utils/sfdisk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index ad0e17e..49369bd 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -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);
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux