aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-04-29 12:30:28 -0500
committerRob Landley <rob@landley.net>2013-04-29 12:30:28 -0500
commitacede57b4fd2d9d7f5cb576bdf12cf8586cef44a (patch)
treec3a99c7724c88594bc80f2d9282a58a1527f8714 /lib/lib.c
parent7a1f582a04f165db489de0648ff31b6b6ace2efd (diff)
downloadtoybox-acede57b4fd2d9d7f5cb576bdf12cf8586cef44a.tar.gz
Fix xabspath when last path component exists but we haven't got permissions to open it (ala readlink -f /dev/sda as a normal user). Spotted by Ashwini Sharma.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index b89f2db8..1066ef9a 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -393,6 +393,7 @@ char *xabspath(char *path, int exact)
if ((exact || todo) && errno != EINVAL) goto error;
new->next = done;
done = new;
+ if (errno == EINVAL && !todo) break;
s = new->str;
}
fd = openat(dirfd, s, 0);