summaryrefslogtreecommitdiffstats
path: root/fdisk/sfdisk.c
diff options
context:
space:
mode:
authorKarel Zak2012-02-02 12:28:54 +0100
committerKarel Zak2012-02-02 12:28:54 +0100
commit06c243d3580a6549c70b7c863d222cd442c4999e (patch)
tree93aa6e401c509df97ff4a11653beeb641788b192 /fdisk/sfdisk.c
parentfindmnt: make --poll more robust (diff)
downloadkernel-qcow2-util-linux-06c243d3580a6549c70b7c863d222cd442c4999e.tar.gz
kernel-qcow2-util-linux-06c243d3580a6549c70b7c863d222cd442c4999e.tar.xz
kernel-qcow2-util-linux-06c243d3580a6549c70b7c863d222cd442c4999e.zip
sfdisk: fix fd leak
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r--fdisk/sfdisk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 3f5f74f37..a1eafb77e 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -2922,14 +2922,14 @@ do_size(char *dev, int silent) {
perror(dev);
errx(EXIT_FAILURE, _("Cannot get size of %s"), dev);
}
- return;
+ goto done;
}
size /= 2; /* convert sectors to blocks */
/* a CDROM drive without mounted CD yields MAXINT */
if (silent && size == ((1 << 30) - 1))
- return;
+ goto done;
if (silent)
printf("%s: %9llu\n", dev, size);
@@ -2938,6 +2938,7 @@ do_size(char *dev, int silent) {
total_size += size;
+done:
close(fd);
}