Paul Eggert <address@hidden> wrote:
...
> 2005-12-25 Paul Eggert <address@hidden>
> * chdir-safer.c (chdir_no_follow): Don't include stdio.h, assert.h,
...
> Open with O_DIRECTORY | O_NOCTTY, for benefit of hosts that
> don't have O_NOFOLLOW.
...
> Index: lib/chdir-safer.c
...
> + int open_flags = O_DIRECTORY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK;
> + int fd = open (dir, O_RDONLY | open_flags);
Hi Paul,
Adding O_DIRECTORY is an improvement, even for systems that do have
O_NOFOLLOW, but how does O_NOCTTY help? Isn't the goal of using O_NOCTTY
to avoid provoking a signal upon e.g., read while backgrounded? But
chdir_no_follow never attempts a read; all it does is call fstat and close.
Is there some other reason to use O_NOCTTY here?
Thanks,
Jim