]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix embarassing bug in 1.10.0 which broke --add
authorNeil Brown <neilb@suse.de>
Mon, 11 Apr 2005 00:20:03 +0000 (00:20 +0000)
committerNeil Brown <neilb@suse.de>
Mon, 11 Apr 2005 00:20:03 +0000 (00:20 +0000)
Use a different variable to old result of open

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
ChangeLog
Manage.c

index 33e729be9a60f3d185e5ed9cab423f27f87eadfb..1c8a10d88658eead881d8ab1d4b0eb6975865812 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Changes Prior to this release
+    -   Fix embarassing bug which causes --add to always fail.
+
 Changes Prior to 1.10.0 release
     -   Fix bug with --config=partitions
     -   Open sub-devices with O_EXCL to detect if already in use
index b323fd3c241b514c24a3138b7f332e09c8841fd8..c1debfa97f9ba9ca7e6af8ed019fb72f30e273c5 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -168,6 +168,7 @@ int Manage_subdevs(char *devname, int fd,
        mddev_dev_t dv;
        struct stat stb;
        int j;
+       int tfd;
        int save_errno;
        static char buf[4096];
 
@@ -195,13 +196,13 @@ int Manage_subdevs(char *devname, int fd,
                case 'a':
                        /* add the device - hot or cold */
                        /* Make sure it isn' in use (in 2.6 or later) */
-                       fd = open(dv->devname, O_RDONLY|O_EXCL);
-                       if (fd < 0) {
+                       tfd = open(dv->devname, O_RDONLY|O_EXCL);
+                       if (tfd < 0) {
                                fprintf(stderr, Name ": Cannot open %s: %s\n",
                                        dv->devname, strerror(errno));
                                return 1;
                        }
-                       close(fd);
+                       close(tfd);
                        if (ioctl(fd, HOT_ADD_DISK, (unsigned long)stb.st_rdev)==0) {
                                fprintf(stderr, Name ": hot added %s\n",
                                        dv->devname);