Skip to contentSkip to conversation

Don't return root if path contains // or ending /

PATCH In review Søren Holm 2 participants 2 messages Sep 26, 2014 – Oct 1, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't return root if path contains // or ending /

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.

---
 libmount/src/tab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmount/src/tab.c +1 -1
index 011ba54..2b0a343 100644
@@ -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');
 
Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 2 lines · Søren Holm
 libmount/src/tab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Stupid mistake. Applied, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com