From: Paul Eggert Date: Tue, 27 Dec 2005 07:53:50 +0000 (+0000) Subject: (cdb_free): Don't bother trying to open directory X-Git-Tag: COREUTILS-6_0~1028 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2c8ec26a4cb771ee0e13e2b08daf0f3c9b03d97;p=platform%2Fupstream%2Fcoreutils.git (cdb_free): Don't bother trying to open directory for write access: POSIX says that must fail. (cdb_free): Open with O_NOCTTY | O_NONBLOCK as well, for minor improvements on hosts that lack O_DIRECTORY. --- diff --git a/lib/chdir-long.c b/lib/chdir-long.c index a727817..8c15d06 100644 --- a/lib/chdir-long.c +++ b/lib/chdir-long.c @@ -77,13 +77,10 @@ cdb_free (struct cd_buf const *cdb) static int cdb_advance_fd (struct cd_buf *cdb, char const *dir) { - int new_fd = openat (cdb->fd, dir, O_RDONLY | O_DIRECTORY); + int new_fd = openat (cdb->fd, dir, + O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK); if (new_fd < 0) - { - new_fd = openat (cdb->fd, dir, O_WRONLY | O_DIRECTORY); - if (new_fd < 0) - return -1; - } + return -1; cdb_free (cdb); cdb->fd = new_fd;