summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/context.c
diff options
context:
space:
mode:
authorSami Kerola2017-05-27 11:03:55 +0200
committerKarel Zak2017-05-29 12:18:08 +0200
commit2e2cfdae79e9250cc2f07885538d7120e76da4d9 (patch)
tree4a6887dab5b172a865c33cc1faf2ae619c9ccdcf /libfdisk/src/context.c
parentlib/colors: Fix bug where help text was not being translated. (diff)
downloadkernel-qcow2-util-linux-2e2cfdae79e9250cc2f07885538d7120e76da4d9.tar.gz
kernel-qcow2-util-linux-2e2cfdae79e9250cc2f07885538d7120e76da4d9.tar.xz
kernel-qcow2-util-linux-2e2cfdae79e9250cc2f07885538d7120e76da4d9.zip
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 <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r--libfdisk/src/context.c14
1 files changed, 8 insertions, 6 deletions
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;
+ }
}
/**