]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdmon.c
sysfs: avoid possible data corruption in sys_load.
[thirdparty/mdadm.git] / mdmon.c
diff --git a/mdmon.c b/mdmon.c
index 407f637add3b400c5b72c401a3da00063df38dbf..c7d7f680db574c31fb58b5c627e05b8f08432b56 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -52,7 +52,6 @@ int run_child(void *v)
 {
        struct supertype *c = v;
 
-       mon_tid = syscall(SYS_gettid);
        do_monitor(c);
        return 0;
 }
@@ -60,16 +59,14 @@ int run_child(void *v)
 int clone_monitor(struct supertype *container)
 {
        static char stack[4096];
-       int rv;
 
-
-       rv = clone(run_child, stack+4096-64,
+       mon_tid = clone(run_child, stack+4096-64,
                   CLONE_FS|CLONE_FILES|CLONE_VM|CLONE_SIGHAND|CLONE_THREAD,
                   container);
 
        mgr_tid = syscall(SYS_gettid);
-       
-       return rv;
+
+       return mon_tid;
 }
 
 static struct superswitch *find_metadata_methods(char *vers)
@@ -270,8 +267,6 @@ int main(int argc, char *argv[])
                        argv[1]);
                exit(3);
        }
-       close(mdfd);
-       close(mdfd);
 
        mlockall(MCL_FUTURE);