X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fopenat-proc.c;h=2e2e966bc74820766c02b06c321c82290f46850d;hb=3cfc178b2dc48cca0decbf69f611e436c8fa3b7a;hp=c326ffcbef2121c88986306f2e9d948a93e7f695;hpb=5f1e41e3755fc46e97ca3ada87779d60751417d2;p=gnulib.git diff --git a/lib/openat-proc.c b/lib/openat-proc.c index c326ffcbe..2e2e966bc 100644 --- a/lib/openat-proc.c +++ b/lib/openat-proc.c @@ -80,10 +80,11 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file) proc_status = -1; else { - /* Detect whether /proc/self/fd/../fd exists. On Linux, that name - resolves to /proc/self/fd, which was opened above. However, on - Solaris, it may resolve to /proc/self/fd/fd, which cannot exist, - since all names in /proc/self/fd are numeric. */ + /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the + number of a file descriptor open on /proc/self/fd. On Linux, + that name resolves to /proc/self/fd, which was opened above. + However, on Solaris, it may resolve to /proc/self/fd/fd, which + cannot exist, since all names in /proc/self/fd are numeric. */ char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)]; sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd"); proc_status = access (dotdot_buf, F_OK) ? -1 : 1;