From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: man/, src/rc/
Date: Thu, 26 Jan 2012 20:51:29 +0000 (UTC) [thread overview]
Message-ID: <7ea5c614d9c9e36c55f1da3d7fb894e83bbb56f3.WilliamH@gentoo> (raw)
commit: 7ea5c614d9c9e36c55f1da3d7fb894e83bbb56f3
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 25 22:18:08 2012 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 20:42:18 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=7ea5c614
Add -W/--writable function to checkpath
Checkpath -W will use access(3p) to determine whether or not a path is
writable. This is more accurate than test(1p) because it also takes into
account whether or not the filesystem is mounted read-only.
Modified by William Hubbs to add the man page update.
---
man/runscript.8 | 5 +++++
src/rc/checkpath.c | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/man/runscript.8 b/man/runscript.8
index 30fde94..5901f47 100644
--- a/man/runscript.8
+++ b/man/runscript.8
@@ -315,6 +315,11 @@ Mark the service as inactive.
.Xc
Checks to see if the path exists, is of the right type, owned by the right
people and has the correct access modes. If not, then it corrects the path.
+.It Ic checkpath
+.Op Fl W , -writable
+.Ar path
+.Xc
+checks to see if the path is writable.
.It Ic yesno Ar value
If
.Ar value
diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c
index b0914f3..7ebbb64 100644
--- a/src/rc/checkpath.c
+++ b/src/rc/checkpath.c
@@ -185,8 +185,8 @@ parse_owner(struct passwd **user, struct group **group, const char *owner)
}
#include "_usage.h"
-#define extraopts "path1 path2 ..."
-#define getoptstring "dDfFpm:o:" getoptstring_COMMON
+#define extraopts "path1 [path2] [...]"
+#define getoptstring "dDfFpm:o:W:" getoptstring_COMMON
static const struct option longopts[] = {
{ "directory", 0, NULL, 'd'},
{ "directory-truncate", 0, NULL, 'D'},
@@ -195,6 +195,7 @@ static const struct option longopts[] = {
{ "pipe", 0, NULL, 'p'},
{ "mode", 1, NULL, 'm'},
{ "owner", 1, NULL, 'o'},
+ { "writable", 1, NULL, 'W'},
longopts_COMMON
};
static const char * const longopts_help[] = {
@@ -205,6 +206,7 @@ static const char * const longopts_help[] = {
"Create a named pipe (FIFO) if not exists",
"Mode to check",
"Owner to check (user:group)",
+ "Check whether the path is writable or not",
longopts_help_COMMON
};
#include "_usage.c"
@@ -249,6 +251,11 @@ checkpath(int argc, char **argv)
eerrorx("%s: owner `%s' not found",
applet, optarg);
break;
+ case 'W':
+ if (argv[optind] != NULL)
+ ewarn("-W/--writable takes only one path, everything else will be ignored");
+ exit(!is_writable(optarg));
+ break;
case_RC_COMMON_GETOPT
}
next reply other threads:[~2012-01-26 20:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 20:51 William Hubbs [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-05-15 22:11 [gentoo-commits] proj/openrc:master commit in: man/, src/rc/ William Hubbs
2018-05-15 0:11 William Hubbs
2017-05-22 17:54 William Hubbs
2017-05-22 17:54 William Hubbs
2017-04-12 22:57 William Hubbs
2016-01-28 19:08 William Hubbs
2014-01-18 7:56 William Hubbs
2013-05-02 18:58 William Hubbs
2013-04-28 18:04 William Hubbs
2012-01-15 1:11 Christian Ruppert
2012-01-10 3:22 Robin H. Johnson
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=7ea5c614d9c9e36c55f1da3d7fb894e83bbb56f3.WilliamH@gentoo \
--to=williamh@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.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