* [PATCH] mountpoint: drop S_ISDIR check
@ 2014-08-21 12:48 Dave Reisner
2014-08-21 13:10 ` Karel Zak
2014-08-21 14:56 ` Bernhard Voelker
0 siblings, 2 replies; 7+ messages in thread
From: Dave Reisner @ 2014-08-21 12:48 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
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(-)
diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c
index cba5f01..3919ab7 100644
--- a/sys-utils/mountpoint.c
+++ b/sys-utils/mountpoint.c
@@ -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);
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mountpoint: drop S_ISDIR check
2014-08-21 12:48 [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
@ 2014-08-21 13:10 ` Karel Zak
2014-08-21 14:56 ` Bernhard Voelker
1 sibling, 0 replies; 7+ messages in thread
From: Karel Zak @ 2014-08-21 13:10 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux
On Thu, Aug 21, 2014 at 08:48:12AM -0400, Dave Reisner wrote:
> sys-utils/mountpoint.c | 6 ------
> 1 file changed, 6 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mountpoint: drop S_ISDIR check
2014-08-21 12:48 [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
2014-08-21 13:10 ` Karel Zak
@ 2014-08-21 14:56 ` Bernhard Voelker
2014-08-21 15:30 ` Adam Sampson
2014-08-21 15:38 ` [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
1 sibling, 2 replies; 7+ messages in thread
From: Bernhard Voelker @ 2014-08-21 14:56 UTC (permalink / raw)
To: Dave Reisner, util-linux
On 08/21/2014 02:48 PM, Dave Reisner wrote:
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mountpoint: drop S_ISDIR check
2014-08-21 14:56 ` Bernhard Voelker
@ 2014-08-21 15:30 ` Adam Sampson
2014-08-21 16:16 ` [PATCH] mountpoint.1: clarify that it works on files Dave Reisner
2014-08-21 15:38 ` [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
1 sibling, 1 reply; 7+ messages in thread
From: Adam Sampson @ 2014-08-21 15:30 UTC (permalink / raw)
To: util-linux
Bernhard Voelker <mail@bernhard-voelker.de> writes:
> 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.
--
Adam Sampson <ats@offog.org> <http://offog.org/>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mountpoint: drop S_ISDIR check
2014-08-21 14:56 ` Bernhard Voelker
2014-08-21 15:30 ` Adam Sampson
@ 2014-08-21 15:38 ` Dave Reisner
1 sibling, 0 replies; 7+ messages in thread
From: Dave Reisner @ 2014-08-21 15:38 UTC (permalink / raw)
To: Bernhard Voelker; +Cc: Dave Reisner, util-linux
On Thu, Aug 21, 2014 at 04:56:58PM +0200, Bernhard Voelker wrote:
> On 08/21/2014 02:48 PM, Dave Reisner wrote:
> > 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
You cannot mount a file on a directory, but you can mount a file on a
file.
Cheers,
d
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mountpoint.1: clarify that it works on files
2014-08-21 15:30 ` Adam Sampson
@ 2014-08-21 16:16 ` Dave Reisner
2014-08-22 6:35 ` Karel Zak
0 siblings, 1 reply; 7+ messages in thread
From: Dave Reisner @ 2014-08-21 16:16 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
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(-)
diff --git a/sys-utils/mountpoint.1 b/sys-utils/mountpoint.1
index 29c153c..078ba25 100644
--- a/sys-utils/mountpoint.1
+++ b/sys-utils/mountpoint.1
@@ -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 <kzak@redhat.com>
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mountpoint.1: clarify that it works on files
2014-08-21 16:16 ` [PATCH] mountpoint.1: clarify that it works on files Dave Reisner
@ 2014-08-22 6:35 ` Karel Zak
0 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2014-08-22 6:35 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux
On Thu, Aug 21, 2014 at 12:16:57PM -0400, Dave Reisner wrote:
> sys-utils/mountpoint.1 | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-22 6:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 12:48 [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
2014-08-21 13:10 ` Karel Zak
2014-08-21 14:56 ` Bernhard Voelker
2014-08-21 15:30 ` Adam Sampson
2014-08-21 16:16 ` [PATCH] mountpoint.1: clarify that it works on files Dave Reisner
2014-08-22 6:35 ` Karel Zak
2014-08-21 15:38 ` [PATCH] mountpoint: drop S_ISDIR check Dave Reisner
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).