]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Use MDMON_DIR for pid files created in Monitor.c
authorJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 2 Feb 2012 11:45:02 +0000 (12:45 +0100)
committerNeilBrown <neilb@suse.de>
Wed, 22 Feb 2012 22:05:16 +0000 (09:05 +1100)
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>
Monitor.c

index 77f22aa37a006d2988671674ea450da23ebd2f89..7ed5282b2c33a85da756f9330cff88d5de2488ee 100644 (file)
--- 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"