Mercurial > hg > toybox
comparison lib/lib.c @ 889:270e5aab9998
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.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 29 Apr 2013 12:30:28 -0500 |
parents | beb32d780164 |
children | 44abb9cac9d7 |
comparison
equal
deleted
inserted
replaced
888:c5e80c74ec6c | 889:270e5aab9998 |
---|---|
391 if (len) { | 391 if (len) { |
392 // Not a symlink: add to linked list, move dirfd, fail if error | 392 // Not a symlink: add to linked list, move dirfd, fail if error |
393 if ((exact || todo) && errno != EINVAL) goto error; | 393 if ((exact || todo) && errno != EINVAL) goto error; |
394 new->next = done; | 394 new->next = done; |
395 done = new; | 395 done = new; |
396 if (errno == EINVAL && !todo) break; | |
396 s = new->str; | 397 s = new->str; |
397 } | 398 } |
398 fd = openat(dirfd, s, 0); | 399 fd = openat(dirfd, s, 0); |
399 if (fd == -1 && (exact || todo || errno != ENOENT)) goto error; | 400 if (fd == -1 && (exact || todo || errno != ENOENT)) goto error; |
400 close(dirfd); | 401 close(dirfd); |