NeilBrown: super1: remove fd leak when opening /dev/urandom
Martin F. Krafft
madduck at alioth.debian.org
Tue Oct 27 19:21:26 UTC 2009
Module: mdadm
Branch: master
Commit: 7cbeb80e900d2cbb47c6de75826769b5addb4867
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=7cbeb80e900d2cbb47c6de75826769b5addb4867
Author: NeilBrown <neilb at suse.de>
Date: Thu Aug 13 15:02:39 2009 +1000
super1: remove fd leak when opening /dev/urandom
As reported in
https://bugzilla.novell.com/show_bug.cgi?id=527722
I forgot to close the fd after reading the random number.
Signed-off-by: NeilBrown <neilb at suse.de>
---
super1.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/super1.c b/super1.c
index 056b93b..fee22a9 100644
--- a/super1.c
+++ b/super1.c
@@ -685,6 +685,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
__u32 r[4] = {random(), random(), random(), random()};
memcpy(sb->device_uuid, r, 16);
}
+ if (rfd >= 0)
+ close(rfd);
sb->dev_roles[i] =
__cpu_to_le16(info->disk.raid_disk);
More information about the pkg-mdadm-commits
mailing list