From: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] nilfs_cleanerd: support relative pathnames in arguments
Date: Sun, 6 Mar 2011 22:30:18 +0100 [thread overview]
Message-ID: <1299447018-19088-1-git-send-email-dexen.devries@gmail.com> (raw)
In-Reply-To: <20110304.120604.248913114.ryusuke-sG5X7nlA6pw@public.gmane.org>
canonicalize pathnames of device & directory before daemonize() to support relative pathnames
Signed-off-by: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
sbin/cleanerd/cleanerd.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
index 1f03cfb..3d58916 100644
--- a/sbin/cleanerd/cleanerd.c
+++ b/sbin/cleanerd/cleanerd.c
@@ -1343,6 +1343,7 @@ static int nilfs_cleanerd_clean_loop(struct nilfs_cleanerd *cleanerd)
int main(int argc, char *argv[])
{
char *progname, *conffile;
+ char canonical[PATH_MAX + 2];
const char *dev, *dir;
char *endptr;
int status, nofork, c;
@@ -1406,6 +1407,12 @@ int main(int argc, char *argv[])
if (optind < argc)
dir = argv[optind++];
+ if (dev && myrealpath(dev, canonical, sizeof(canonical)))
+ dev = strdup(canonical);
+
+ if (dir && myrealpath(dir, canonical, sizeof(canonical)))
+ dir = strdup(canonical);
+
if (daemonize(0, 0, nofork) < 0) {
fprintf(stderr, "%s: %s\n", progname, strerror(errno));
exit(1);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-03-06 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 17:12 nilfs_cleanerd not started for mount with relative pathname dexen deVries
[not found] ` <201103021812.31515.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 17:32 ` Ryusuke Konishi
[not found] ` <20110304.023204.179943022.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-04 3:06 ` Ryusuke Konishi
[not found] ` <20110304.120604.248913114.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-03-06 21:30 ` dexen deVries [this message]
[not found] ` <1299447018-19088-1-git-send-email-dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-07 2:32 ` [PATCH] nilfs_cleanerd: support relative pathnames in arguments Ryusuke Konishi
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=1299447018-19088-1-git-send-email-dexen.devries@gmail.com \
--to=dexen.devries-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).