From 2e2cfdae79e9250cc2f07885538d7120e76da4d9 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 27 May 2017 10:03:55 +0100 Subject: libfdisk: fix variable shadowing 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 [kzak@redhat.com: - add rc to debug message] Signed-off-by: Sami Kerola Signed-off-by: Karel Zak --- libfdisk/src/context.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libfdisk/src') diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index 52fd57987..951310ffa 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 [rc=%d]", rc)); + return rc; + } } /** -- cgit v1.2.3-55-g7522