[v5,03/12] nptl_db/thread_dbP.h: fix warn unused result

Message ID 20230601142747.104444-3-fberat@redhat.com
State Committed
Commit a952fcda58cd7aa191140fc9e7d453df212b9117
Headers
Series [v5,01/12] catgets/gencat.c: fix warn unused result |

Commit Message

Frederic Berat June 1, 2023, 2:27 p.m. UTC
  Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
---
Changes since v5:
 - Wrapped line since it exceeded 79 characters

 nptl_db/thread_dbP.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar June 1, 2023, 4:49 p.m. UTC | #1
On 2023-06-01 10:27, Frédéric Bérat wrote:
> Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
> glibc.
> ---
> Changes since v5:
>   - Wrapped line since it exceeded 79 characters
> 
>   nptl_db/thread_dbP.h | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

> 
> diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
> index 8845722109..b52c254300 100644
> --- a/nptl_db/thread_dbP.h
> +++ b/nptl_db/thread_dbP.h
> @@ -61,7 +61,9 @@ enum
>   
>   /* Comment out the following for less verbose output.  */
>   #ifndef NDEBUG
> -# define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
> +# define LOG(c) \
> +  if (__td_debug) \
> +    assert (write (2, c "\n", strlen (c "\n")) == strlen (c "\n"))
>   extern int __td_debug attribute_hidden;
>   #else
>   # define LOG(c)
  

Patch

diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
index 8845722109..b52c254300 100644
--- a/nptl_db/thread_dbP.h
+++ b/nptl_db/thread_dbP.h
@@ -61,7 +61,9 @@  enum
 
 /* Comment out the following for less verbose output.  */
 #ifndef NDEBUG
-# define LOG(c) if (__td_debug) write (2, c "\n", strlen (c "\n"))
+# define LOG(c) \
+  if (__td_debug) \
+    assert (write (2, c "\n", strlen (c "\n")) == strlen (c "\n"))
 extern int __td_debug attribute_hidden;
 #else
 # define LOG(c)