areadlinkat: avoid failure on older glibc
authorEric Blake <ebb9@byu.net>
Thu, 22 Oct 2009 03:01:41 +0000 (21:01 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 22 Oct 2009 03:31:52 +0000 (21:31 -0600)
commit447ce7436647899cfe03ee154bb2b2789d3a8eac
treef18ea42e22a9232e120ddaaf39307a00e6965724
parent4bb09526539ef33e14c130d2b22e6d49dfdfe3b0
areadlinkat: avoid failure on older glibc

Acting on /proc/self/-1/name gives ENOTDIR.  at-func normally falls
back to fchdir, which discovers the real problem of invalid fd and
changes to EBADF; but for areadlinkat, it mistakenly short-circuited
when FUNC_FAIL was NULL (since 0<=(char*)result is always true).

* lib/at-func.c (AT_FUNC_NAME): Check for explicit FUNC_FAIL,
rather than mis-comparing 0 against FUNC_RESULT of char*.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/at-func.c