linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Clements <Paul.Clements@SteelEye.com>
To: Simon Edwards <simon.edwards@proprius.co.uk>
Cc: linux-raid@vger.kernel.org
Subject: Re: Suggested patch against raidtools
Date: Mon, 10 Mar 2003 00:54:49 -0500	[thread overview]
Message-ID: <3E6C28A9.74798DF6@SteelEye.com> (raw)
In-Reply-To: 000601c2e696$2a24e8a0$05eb10ac@bongo2

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Simon Edwards wrote:

> if you try and use "md1" and "md10"
> you'll get an error saying the device is already running.

Hmm...coincidentally, I just reported this same bug to Red Hat a couple
of days ago. The patch that I came up with is attached...although, yours
seems to be a little simpler.

--
Paul

[-- Attachment #2: raidtools.diff --]
[-- Type: text/plain, Size: 966 bytes --]

diff -urN raidtools-1.00.2/raid_io.c raidtools-1.00.2steeleye/raid_io.c
--- raidtools-1.00.2/raid_io.c	Mon Apr 15 04:09:11 2002
+++ raidtools-1.00.2steeleye/raid_io.c	Thu Feb 27 15:22:07 2003
@@ -515,8 +515,10 @@
 }
 
 
+
 int check_active (md_cfg_entry_t *p)
 {
+	char md_dev_chars[] = "0123456789md";
 	char buffer[MAX_LINE_LENGTH], line[MAX_LINE_LENGTH], *ch;
 	FILE *fp;
 
@@ -528,11 +530,15 @@
 	while (1) {
 		if ((fgets(line, MAX_LINE_LENGTH, fp)) == NULL)
 			break;
-		if (strstr(line, buffer) && !strstr(line, "inactive")) {
-			fprintf(stderr, "%s: array is active -- run raidstop first.\n", p->md_name);
-			fclose(fp);
-			return 1;
-		}
+		if (!(ch = strstr(line, buffer)))
+			continue;
+		if (strspn(ch, md_dev_chars) != strspn(buffer, md_dev_chars))
+			continue;
+		if (strstr(line, "inactive"))
+			continue;
+		fprintf(stderr, "%s: array is active -- run raidstop first.\n", p->md_name);
+		fclose(fp);
+		return 1;
 	}
 	fclose(fp);
 	return 0;

      reply	other threads:[~2003-03-10  5:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-09 23:46 Suggested patch against raidtools Simon Edwards
2003-03-10  5:54 ` Paul Clements [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E6C28A9.74798DF6@SteelEye.com \
    --to=paul.clements@steeleye.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=simon.edwards@proprius.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).