[8/8] sysdeps/pthread/eintr.c: fix warn unused result

Message ID 20230418121130.844302-9-fberat@redhat.com
State Superseded
Headers
Series Fix warn unused result |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Frederic Berat April 18, 2023, 12:11 p.m. UTC
  Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
---
 sysdeps/pthread/eintr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Siddhesh Poyarekar April 18, 2023, 12:54 p.m. UTC | #1
On 2023-04-18 08:11, Frédéric Bérat via Libc-alpha wrote:
> Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
> glibc.
> ---
>   sysdeps/pthread/eintr.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/pthread/eintr.c b/sysdeps/pthread/eintr.c
> index 000649d24e..8441df0c77 100644
> --- a/sysdeps/pthread/eintr.c
> +++ b/sysdeps/pthread/eintr.c
> @@ -31,10 +31,10 @@ eintr_handler (int sig)
>   {
>     if (sig != the_sig)
>       {
> -      write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35);
> +      if (write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35)) {};

Perhaps add a little comment here saying that it avoids the __wur? 
Also, make the check < 35 so that it's semantically correct.

>         _exit (1);
>       }
> -  write (STDOUT_FILENO, ".", 1);
> +  if (write (STDOUT_FILENO, ".", 1)) {};
>   }

Likewise.

>   
>   

Thanks,
Sid
  

Patch

diff --git a/sysdeps/pthread/eintr.c b/sysdeps/pthread/eintr.c
index 000649d24e..8441df0c77 100644
--- a/sysdeps/pthread/eintr.c
+++ b/sysdeps/pthread/eintr.c
@@ -31,10 +31,10 @@  eintr_handler (int sig)
 {
   if (sig != the_sig)
     {
-      write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35);
+      if (write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35)) {};
       _exit (1);
     }
-  write (STDOUT_FILENO, ".", 1);
+  if (write (STDOUT_FILENO, ".", 1)) {};
 }