bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how does O_NOCTTY help? [Re: bug in chdir-safer


From: Jim Meyering
Subject: how does O_NOCTTY help? [Re: bug in chdir-safer
Date: Thu, 09 Feb 2006 17:36:29 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]