(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.
This commit is contained in:
Paul Eggert 2005-12-27 07:53:50 +00:00
parent edf69af317
commit a2c8ec26a4

View File

@ -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;