From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH] mountpoint: symlinks are not mount points
Date: Thu, 21 Aug 2014 21:03:10 +0300 [thread overview]
Message-ID: <1408644191-13523-1-git-send-email-kerolasa@iki.fi> (raw)
Hello,
Another small change on top of Daves earlier mountpoint(1) correction.
Now when mount points are not restricted to directories it is reasonable
not to follow symlinks. Notice that this is not a regression from Daves
change but something the command has always done.
--->8----
From: Sami Kerola <kerolasa@iki.fi>
Date: Thu, 21 Aug 2014 20:16:30 +0300
Subject: [PATCH] mountpoint: symlinks are not mount points
Earlier the mountpoint(1) followed symlinks, claiming they were mount
points when they only referred one.
$ ls -l /tmp/this-is-symlink
lrwxrwxrwx 1 kerolasa kerolasa 1 Aug 21 19:54 /tmp/this-is-symlink -> /
$ mountpoint /tmp/this-is-symlink
/tmp/this-is-symlink is a mountpoint
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/mountpoint.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c
index 3919ab7..11a611f 100644
--- a/sys-utils/mountpoint.c
+++ b/sys-utils/mountpoint.c
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
spec = argv[optind++];
- if (stat(spec, &st)) {
+ if (lstat(spec, &st)) {
if (!quiet)
err(EXIT_FAILURE, "%s", spec);
return EXIT_FAILURE;
@@ -192,7 +192,7 @@ int main(int argc, char **argv)
else {
dev_t src;
- if ( dir_to_device(spec, &src)) {
+ if (dir_to_device(spec, &src) || S_ISLNK(st.st_mode)) {
if (!quiet)
printf(_("%s is not a mountpoint\n"), spec);
return EXIT_FAILURE;
--
2.1.0
next reply other threads:[~2014-08-21 18:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 18:03 Sami Kerola [this message]
2014-08-21 19:28 ` [PATCH] mountpoint: symlinks are not mount points Bernhard Voelker
2014-08-21 21:34 ` Sami Kerola
2014-08-22 6:34 ` Karel Zak
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=1408644191-13523-1-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--cc=util-linux@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