Bug in the raidtools-1.00.3 package

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
With the raidtools package, mkraid fails while creating devices /dev/md1
when the raid device /dev/md10 is already running.
The problem is that the code has used strstr("/dev/md1", "/dev/md10")  which
returns valid pointer, which outputs 
"array is active - run raidstop first" error message.

I am including a patch for the code.

diff -urN raidtools-1.00.3/raid_io.c raidtools-1.00.3-new/raid_io.c
--- raidtools-1.00.3/raid_io.c  2002-12-11 12:35:14.000000000 -0500
+++ raidtools-1.00.3-new/raid_io.c      2003-09-17 16:20:19.000000000 -0400
@@ -520,6 +520,9 @@
        char buffer[MAX_LINE_LENGTH], line[MAX_LINE_LENGTH], *ch;
        FILE *fp;

+       memset(buffer, 0, MAX_LINE_LENGTH);
+       memset(line, 0, MAX_LINE_LENGTH);
+
        if ((ch = strstr(p->md_name, "/md")) == NULL)
                return 0;
        strcpy(buffer, ch+1);
@@ -528,7 +531,7 @@
        while (1) {
                if ((fgets(line, MAX_LINE_LENGTH, fp)) == NULL)
                        break;
-               if (strstr(line, buffer) && !strstr(line, "inactive")) {
+               if (!strcmp(line, buffer) && !strstr(line, "inactive")) {
                        fprintf(stderr, "%s: array is active -- run raidstop
first.\n", p->md_name);
                        fclose(fp);
                        return 1;

Regards,
Suresh Grandhi
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux