[PATCH] libfdisk: fix variable shadowing

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

 



libfdisk/src/context.c: In function 'fdisk_assign_device':
libfdisk/src/context.c:549:7: warning: declaration of 'rc' shadows a previous local [-Wshadow]
libfdisk/src/context.c:542:10: note: shadowed declaration is here

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 libfdisk/src/context.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 52fd57987..5cf27a948 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -539,7 +539,7 @@ static void reset_context(struct fdisk_context *cxt)
 int fdisk_assign_device(struct fdisk_context *cxt,
 			const char *fname, int readonly)
 {
-	int fd, rc = 0;
+	int fd;
 
 	DBG(CXT, ul_debugobj(cxt, "assigning device %s", fname));
 	assert(cxt);
@@ -600,11 +600,13 @@ int fdisk_assign_device(struct fdisk_context *cxt,
 			      fname, readonly ? "READ-ONLY" : "READ-WRITE"));
 	return 0;
 fail:
-	rc = -errno;
-	if (fd >= 0)
-		close(fd);
-	DBG(CXT, ul_debugobj(cxt, "failed to assign device"));
-	return rc;
+	{
+		int rc = -errno;
+		if (fd >= 0)
+			close(fd);
+			DBG(CXT, ul_debugobj(cxt, "failed to assign device"));
+		return rc;
+	}
 }
 
 /**
-- 
2.13.0

--
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