Re: [PATCH 2/2] Use F_SETFL after F_SETOWN
Simon Marchi <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
On 7/17/26 1:07 PM, Tom Tromey wrote:
> This changes enable_async_notification to use F_SETFL after F_SETOWN.
> This order more correct because it ensures that the owning process is
Missing "is".
> set before the request to enable SIGIO.
> ---
> gdbserver/remote-utils.cc | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
> index ffde4956776..e92adf903ce 100644
> --- a/gdbserver/remote-utils.cc
> +++ b/gdbserver/remote-utils.cc
> @@ -128,13 +128,11 @@ static void
> enable_async_notification (int fd)
> {
> #if defined(F_SETFL) && defined (FASYNC)
> - int save_fcntl_flags;
> -
> - save_fcntl_flags = fcntl (fd, F_GETFL, 0);
> - fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
> #if defined (F_SETOWN)
> fcntl (fd, F_SETOWN, getpid ());
> #endif
> + int save_fcntl_flags = fcntl (fd, F_GETFL, 0);
> + fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
While touching these lines, could you maybe indent the inner #if and
#endif? Like:
#if defined(F_SETFL) && defined (FASYNC)
# if defined (F_SETOWN)
fcntl (fd, F_SETOWN, getpid ());
# endif
int save_fcntl_flags = fcntl (fd, F_GETFL, 0);
fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
#endif
Approved-By: Simon Marchi <[email protected]>
Simon