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@suse.de>
This commit is contained in:
NeilBrown 2009-08-13 15:02:39 +10:00
parent 4737ae25de
commit 7cbeb80e90
1 changed files with 2 additions and 0 deletions

View File

@ -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);