From acede57b4fd2d9d7f5cb576bdf12cf8586cef44a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 29 Apr 2013 12:30:28 -0500 Subject: 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. --- lib/lib.c | 1 + 1 file changed, 1 insertion(+) 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); -- cgit v1.2.3