openat: add comments
authorJim Meyering <meyering@redhat.com>
Tue, 10 May 2011 07:46:59 +0000 (09:46 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 10 May 2011 07:46:59 +0000 (09:46 +0200)
* lib/openat-proc.c (openat_proc_name): Add comments,
mostly from Eric Blake.

ChangeLog
lib/openat-proc.c

index 36fb1fecf6d8a4e41eb48786ae631cb42c66f889..5a89d18d5bdbf42f4d66e924acfd6e6297a8e17f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-10  Jim Meyering  <meyering@redhat.com>
+
+       openat: add comments
+       * lib/openat-proc.c (openat_proc_name): Add comments,
+       mostly from Eric Blake.
+
 2011-05-09  Eric Blake  <eblake@redhat.com>
 
        openat: reduce syscalls in first probe of /proc
index 5711896a16134fa9f4471fdd16f44b419d0634c0..c326ffcbef2121c88986306f2e9d948a93e7f695 100644 (file)
@@ -80,6 +80,10 @@ 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.  */
           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;