From: Mateusz Kusiak <mateusz.kusiak@intel.com>
To: linux-raid@vger.kernel.org
Cc: jes@trained-monkey.org, mariusz.tkaczyk@linux.intel.com
Subject: [PATCH 1/1] Monitor: Allow no PID in check_one_sharer()
Date: Wed, 28 Feb 2024 16:37:20 +0100 [thread overview]
Message-ID: <20240228153720.12685-2-mateusz.kusiak@intel.com> (raw)
In-Reply-To: <20240228153720.12685-1-mateusz.kusiak@intel.com>
Commit 5fb5479ad100 ("Monitor: open file before check in
check_one_sharer()") introduced a regression that prohibits monitor
from starting if PID file does not exist.
Add check for no PID file.
Add missing fclose().
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
---
Monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Monitor.c b/Monitor.c
index 7cee95d4487a..9be2b5287a1a 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -453,12 +453,17 @@ static int check_one_sharer(int scan)
fp = fopen(AUTOREBUILD_PID_PATH, "r");
if (!fp) {
+ /* PID file does not exist */
+ if (errno == ENOENT)
+ return 0;
+
pr_err("Cannot open %s file.\n", AUTOREBUILD_PID_PATH);
return 2;
}
if (!is_file(AUTOREBUILD_PID_PATH)) {
pr_err("%s is not a regular file.\n", AUTOREBUILD_PID_PATH);
+ fclose(fp);
return 2;
}
--
2.35.3
next prev parent reply other threads:[~2024-02-28 15:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 15:37 [PATCH 0/1] Fix regression when no PID file Mateusz Kusiak
2024-02-28 15:37 ` Mateusz Kusiak [this message]
2024-02-29 13:10 ` Mariusz Tkaczyk
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=20240228153720.12685-2-mateusz.kusiak@intel.com \
--to=mateusz.kusiak@intel.com \
--cc=jes@trained-monkey.org \
--cc=linux-raid@vger.kernel.org \
--cc=mariusz.tkaczyk@linux.intel.com \
/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).