linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] Use MDMON_DIR for pid files created in Monitor.c
Date: Thu,  2 Feb 2012 12:45:02 +0100	[thread overview]
Message-ID: <1328183102-9377-1-git-send-email-Jes.Sorensen@redhat.com> (raw)

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Other parts of mdadm/mdmon place .pid/.sock files in MDMON_DIR. This
makes Monitor.c consistent with the rest.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Monitor.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index 77f22aa..7ed5282 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -294,8 +294,10 @@ static int check_one_sharer(int scan)
 	int pid, rv;
 	FILE *fp;
 	char dir[20];
+	char path[100];
 	struct stat buf;
-	fp = fopen("/var/run/mdadm/autorebuild.pid", "r");
+	sprintf(path, "%s/autorebuild.pid", MDMON_DIR);
+	fp = fopen(path, "r");
 	if (fp) {
 		if (fscanf(fp, "%d", &pid) != 1)
 			pid = -1;
@@ -317,12 +319,12 @@ static int check_one_sharer(int scan)
 		fclose(fp);
 	}
 	if (scan) {
-		if (mkdir("/var/run/mdadm", S_IRWXU) < 0 &&
+		if (mkdir(MDMON_DIR, S_IRWXU) < 0 &&
 		    errno != EEXIST) {
 			fprintf(stderr, Name ": Can't create "
 				"autorebuild.pid file\n");
 		} else {
-			fp = fopen("/var/run/mdadm/autorebuild.pid", "w");
+			fp = fopen(path, "w");
 			if (!fp)
 				fprintf(stderr, Name ": Cannot create"
 					" autorebuild.pid"
-- 
1.7.4.4


             reply	other threads:[~2012-02-02 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 11:45 Jes.Sorensen [this message]
2012-02-22 22:12 ` [PATCH] Use MDMON_DIR for pid files created in Monitor.c NeilBrown
2012-02-23 20:39 ` CoolCold
2012-02-23 20:47   ` Jes Sorensen

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=1328183102-9377-1-git-send-email-Jes.Sorensen@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).