X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=blobdiff_plain;f=Assemble.c;h=ace5717c310adb7dc932b21dd30bc67756025df9;hp=4e4e12314cce1d20f8eba09d584a1bdf0ca62c2c;hb=d7eaf49f65ecb99e24255026331b0af7a9245cc2;hpb=b568741513da4cc6284815345473f67f7cdee1df diff --git a/Assemble.c b/Assemble.c index 4e4e1231..ace5717c 100644 --- a/Assemble.c +++ b/Assemble.c @@ -193,7 +193,7 @@ int Assemble(char *mddev, int mdfd, continue; } - dfd = open(devname, O_RDONLY, 0); + dfd = open(devname, O_RDONLY|O_EXCL, 0); if (dfd < 0) { if (inargv || verbose) fprintf(stderr, Name ": cannot open device %s: %s\n", @@ -326,7 +326,7 @@ int Assemble(char *mddev, int mdfd, super.recovery_cp = 0; } super.sb_csum = calc_sb_csum(&super); - dfd = open(devname, O_RDWR, 0); + dfd = open(devname, O_RDWR|O_EXCL, 0); if (dfd < 0) fprintf(stderr, Name ": Cannot open %s for superblock update\n", devname); @@ -435,7 +435,7 @@ int Assemble(char *mddev, int mdfd, devices[chosen_drive].devname, devices[chosen_drive].raid_disk, (int)(devices[chosen_drive].events), (int)(devices[most_recent].events)); - fd = open(devices[chosen_drive].devname, O_RDWR); + fd = open(devices[chosen_drive].devname, O_RDWR|O_EXCL); if (fd < 0) { fprintf(stderr, Name ": Couldn't open %s for write - not updating\n", devices[chosen_drive].devname); @@ -484,7 +484,7 @@ int Assemble(char *mddev, int mdfd, if (!devices[j].uptodate) continue; chosen_drive = j; - if ((fd=open(devices[j].devname, O_RDONLY))< 0) { + if ((fd=open(devices[j].devname, O_RDONLY|O_EXCL))< 0) { fprintf(stderr, Name ": Cannot open %s: %s\n", devices[j].devname, strerror(errno)); return 1; @@ -556,7 +556,7 @@ This doesnt work yet || (old_linux && (change & 1))) { int fd; super.sb_csum = calc_sb_csum(&super); - fd = open(devices[chosen_drive].devname, O_RDWR); + fd = open(devices[chosen_drive].devname, O_RDWR|O_EXCL); if (fd < 0) { fprintf(stderr, Name ": Could open %s for write - cannot Assemble array.\n", devices[chosen_drive].devname);