]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: fix fd leak
authorKarel Zak <kzak@redhat.com>
Thu, 2 Feb 2012 11:28:54 +0000 (12:28 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 2 Feb 2012 11:28:54 +0000 (12:28 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk/sfdisk.c

index 3f5f74f37582848133b45e8ef805745baf516abb..a1eafb77ea1d9bee81bde60a98df90ea01158877 100644 (file)
@@ -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);
 }