[PATCH 3/4] disk-utils: fix: opened file leaving unclosed

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

 



Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>

---
 disk-utils/blockdev.c |    4 ++++
 disk-utils/isosize.c  |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
index d02ebbc..474d0db 100644
--- a/disk-utils/blockdev.c
+++ b/disk-utils/blockdev.c
@@ -394,6 +394,8 @@ report_all_devices(void) {
 		sprintf(device, "/dev/%s", ptname);
 		report_device(device, 1);
 	}
+
+	fclose(procpt);
 }
 
 void
@@ -427,6 +429,8 @@ report_device(char *device, int quiet) {
 			fprintf(stderr, _("%s: ioctl error on %s\n"),
 				progname, device);
 	}
+
+	close(fd);
 }
 
 void
diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c
index 2064021..3f22ab8 100644
--- a/disk-utils/isosize.c
+++ b/disk-utils/isosize.c
@@ -159,6 +159,8 @@ isosize(char *filenamep) {
 		else
 			printf ("%lld\n", (product * ssize) / divisor);
 	}
+
+	close(fd);
 }
 
 int
-- 
1.5.3.rc7

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" 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