From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH] Use MDMON_DIR for pid files created in Monitor.c
Date: Thu, 23 Feb 2012 09:12:14 +1100 [thread overview]
Message-ID: <20120223091214.3babc1b1@notabene.brown> (raw)
In-Reply-To: <1328183102-9377-1-git-send-email-Jes.Sorensen@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1413 bytes --]
On Thu, 2 Feb 2012 12:45:02 +0100 Jes.Sorensen@redhat.com wrote:
> 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"
Applied (at last).
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-02-22 22:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 11:45 [PATCH] Use MDMON_DIR for pid files created in Monitor.c Jes.Sorensen
2012-02-22 22:12 ` NeilBrown [this message]
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=20120223091214.3babc1b1@notabene.brown \
--to=neilb@suse.de \
--cc=Jes.Sorensen@redhat.com \
--cc=linux-raid@vger.kernel.org \
/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).