mountpoint: drop S_ISDIR check
PATCH 1/1 mountpoint: drop S_ISDIR check
Files can be mountpoints, too.
---
I can't find any reason for this check -- it seems to have existed since mountpoint was added to the util-linux tree.
sys-utils/mountpoint.c | 6 ------ 1 file changed, 6 deletions(-)
sys-utils/mountpoint.c +0 -6
@@ -192,12 +192,6 @@ int main(int argc, char **argv)else {dev_t src; -if (!S_ISDIR (st.st_mode)) { -if (!quiet) -errx (EXIT_FAILURE ,_ ("%s: not a directory" ), spec); -return EXIT_FAILURE ; - } -if (dir_to_device (spec, &src)) {if (!quiet)printf (_ ("%s is not a mountpoint\n" ), spec);
Signature · 1 line
2.1.0
Quoted 2 lines · Dave Reisner
sys-utils/mountpoint.c | 6 ------ 1 file changed, 6 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 1 line · Dave Reisner
Files can be mountpoints, too.
just out of curiosity - how?
$ touch /tmp/mountpoint $ mount -t proc proc /tmp/mountpoint mount: mount point /tmp/mountpoint is not a directory
Thanks & have a nice day,
Berny
Quoted 11 lines · Bernhard Voelker
Quoted 1 line · Dave Reisner
Files can be mountpoints, too.
just out of curiosity - how?
$ touch /tmp/mountpoint $ mount -t proc proc /tmp/mountpoint mount: mount point /tmp/mountpoint is not a directoryThanks & have a nice day,
Berny
You cannot mount a file on a directory, but you can mount a file on a file.
Cheers,
d
Quoted 1 line · Bernhard Voelker
just out of curiosity - how?
It's certainly possible with bind mounts:
# touch /foo # mount --bind /etc/hostname /foo # mountpoint /foo mountpoint: /foo: not a directory
(whereas it works fine for a bind-mounted directory).
However, the mountpoint(1) man page talks explicitly about the argument being a directory, so that should probably be updated as well if it now works on files too.
Signature · 1 line
Adam Sampson <[email protected]> <http://offog.org/>
PATCH 1/1 mountpoint.1: clarify that it works on files
fef4dfa174 removed the restriction that the argument must explicitly be a directory, so let's fix up the documentation to reflect that.
--- sys-utils/mountpoint.1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sys-utils/mountpoint.1 +6 -2
@@ -1,11 +1,13 @@ .\" -*- nroff -*- .TH MOUNTPOINT 1 "July 2014" "util-linux" "User Commands" .SH NAME -mountpoint \- see if a directory is a mountpoint +mountpoint \- see if a directory or file is a mountpoint .SH SYNOPSIS .B mountpoint .RB [ \-d | \-q ] .I directory +| +.I file .sp .B mountpoint .B \-x
@@ -15,6 +17,8 @@ mountpoint \- see if a directory is a mountpoint .B mountpoint checks whether the given .I directory +or +.I file is mentioned in the /proc/self/mountinfo file. .SH OPTIONS .TP
@@ -34,7 +38,7 @@ Display version information and exit. .BR \-h , " \-\-help" Display help text and exit. .SH EXIT STATUS -Zero if the directory is a mountpoint, non-zero if not. +Zero if the directory or file is a mountpoint, non-zero if not. .SH AUTHOR .PP Karel Zak <[email protected]>
Signature · 1 line
2.1.0
Re: [PATCH] mountpoint.1: clarify that it works on files
Quoted 2 lines · Dave Reisner
sys-utils/mountpoint.1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com