util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't return root if path contains // or ending /
@ 2014-09-26 16:35 Søren Holm
  2014-10-01  8:02 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Søren Holm @ 2014-09-26 16:35 UTC (permalink / raw)
  To: util-linux; +Cc: Søren Holm

If the path fx. is /foo/bar/ the initial stripoff will replace the last slash
with \0 and return a pointer to that exact \0 character. The same thing will
happen if the path contains // somewhere.

Signed-off-by: Søren Holm <sgh@sgh.dk>
---
 libmount/src/tab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 011ba54..2b0a343 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -864,7 +864,7 @@ struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
 		}
 
 		p = stripoff_last_component(mnt);
-		if (!p || !*p)
+		if (!p)
 			break;
 	} while (mnt && *(mnt + 1) != '\0');
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't return root if path contains // or ending /
  2014-09-26 16:35 [PATCH] Don't return root if path contains // or ending / Søren Holm
@ 2014-10-01  8:02 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-10-01  8:02 UTC (permalink / raw)
  To: Søren Holm; +Cc: util-linux

On Fri, Sep 26, 2014 at 06:35:11PM +0200, Søren Holm wrote:
>  libmount/src/tab.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

 Stupid mistake. Applied, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-01  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26 16:35 [PATCH] Don't return root if path contains // or ending / Søren Holm
2014-10-01  8:02 ` Karel Zak

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).