todo += m;
+ /* Empty? Then we reached the end. */
+ if (isempty(first))
+ break;
+
/* Just a single slash? Then we reached the end. */
- if (isempty(first) || path_equal(first, "/"))
+ if (path_equal(first, "/")) {
+ /* Preserve the trailing slash */
+ if (!strextend(&done, "/", NULL))
+ return -ENOMEM;
+
break;
+ }
/* Just a dot? Then let's eat this up. */
if (path_equal(first, "/."))