summaryrefslogtreecommitdiff
path: root/lib/chdir-safer.c
AgeCommit message (Collapse)Author
2006-01-09fix typo in commentJim Meyering
2005-12-27(chdir_no_follow): Don't bother trying to open directory for writePaul Eggert
access: POSIX says that must fail.
2005-12-26(chdir_no_follow): Move declaration of local,Jim Meyering
sb2, `down' into the scope where it is used. Note that on some systems this function also fails when DIR is a writable-yet-unreadable directory.
2005-12-25Whoops; don't remove the include for unistd.h, since it defines fchdir.Paul Eggert
2005-12-25(chdir_no_follow): Don't include stdio.h, assert.h,Paul Eggert
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).
2005-12-25(chdir_no_follow): Remove unnecessary test of S_ISDIR (sb_init.st_mode).Jim Meyering
2005-12-23(chdir_no_follow): Rewrite to use fchdir evenJim Meyering
when O_NOFOLLOW is not defined. Suggested by Eric Blake.
2005-12-23(O_NOFOLLOW): Define, if necessary.Jim Meyering
2005-12-21like chdir(2), but safer, if possibleJim Meyering