From a2c8ec26a4cb771ee0e13e2b08daf0f3c9b03d97 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Dec 2005 07:53:50 +0000 Subject: [PATCH] (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. --- lib/chdir-long.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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; -- 2.7.4