summaryrefslogtreecommitdiff
path: root/Monitor.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2012-02-02 12:45:02 +0100
committerNeilBrown <neilb@suse.de>2012-02-23 09:05:16 +1100
commit0011874f7e8ee85b8c0d52a37ca461248864017a (patch)
treebb3d24643f3e95b975ff85ad8f6f99ce2d58871a /Monitor.c
parent4011421332681ba733a2fc90de7ac94da8593418 (diff)
Use MDMON_DIR for pid files created in Monitor.c
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> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Monitor.c b/Monitor.c
index 77f22aa3..7ed5282b 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"