]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super1: remove fd leak when opening /dev/urandom
authorNeilBrown <neilb@suse.de>
Thu, 13 Aug 2009 05:02:39 +0000 (15:02 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 13 Aug 2009 05:02:39 +0000 (15:02 +1000)
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>
super1.c

index 056b93bb7dafdb9ba541903fec515e7bede42df6..fee22a971aa1ce16496e7d636a93b0cc43a47921 100644 (file)
--- 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);