(chdir_no_follow): Don't include stdio.h, assert.h,
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Dec 2005 21:35:38 +0000 (21:35 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Dec 2005 21:35:38 +0000 (21:35 +0000)
commit8b9f6b163aaae865aaf556b5fbf301ce26c26ddf
treebc1b1c049ad69278ee26fbda9380ca4d733635f9
parent532cf2ac3314dc05fb4713a0d2544493c0551bc0
(chdir_no_follow): Don't include stdio.h, assert.h,
unistd.h, fcntl--.h; not needed.
(O_DIRECTORY): Define if not already defined.
(chdir_no_follow): Revamp describing comment to match code more
closely.  Redo use of internal vars to avoid lint complaints.
Work even if directory is writeable but not readable.
Open with O_DIRECTORY | O_NOCTTY, for benefit of hosts that
don't have O_NOFOLLOW.  Use O_NONBLOCK (POSIX spelling) rather
than O_NDELAY.  Don't bother invoking fstat if open does not
dereference symlink, since the result isn't used then.
Don't assume file descriptor is positive; it might be zero
now that we no longer include fcntl--.h (we don't need fcntl--.h
since we immediately close the descriptor).
lib/chdir-safer.c