linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use MDMON_DIR for pid files created in Monitor.c
@ 2012-02-02 11:45 Jes.Sorensen
  2012-02-22 22:12 ` NeilBrown
  2012-02-23 20:39 ` CoolCold
  0 siblings, 2 replies; 4+ messages in thread
From: Jes.Sorensen @ 2012-02-02 11:45 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-23 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 11:45 [PATCH] Use MDMON_DIR for pid files created in Monitor.c Jes.Sorensen
2012-02-22 22:12 ` NeilBrown
2012-02-23 20:39 ` CoolCold
2012-02-23 20:47   ` Jes Sorensen

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).