This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add __wur for GNU strerror_r()


Hi!
Attached patch adds __wur for GNU version of strerror_r() as not using
it's return value is always mistake.

Moreover this causes warning to be emited when GNU version is used when
the code expects XSI version (that now compiles cleanly).

Such confusion could easily happen when some of the used headers define
_GNU_SOUCE, looking into my system these include Python.h, Image Magick
magick-config.h, awk.h, etc...

-- 
Cyril Hrubis
chrubis@suse.cz
>From 856ecc9869ada9c0d7935e6295d93bf8a58c2cdc Mon Sep 17 00:00:00 2001
From: Cyril Hrubis <metan@ucw.cz>
Date: Thu, 7 Jun 2012 14:57:02 +0200
Subject: [PATCH] Add __wur to GNU version of strerror_r.

Not using the result of the GNU strerror_r() is always a mistake.

Moreover this would generate warning if XSI version was expected but GNU
version was used instead (because some random used header defined
_GNU_SOURCE which was Python.h in this case).

Signed-off-by: Cyril Hrubis <metan@ucw.cz>
---
 string/string.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/string/string.h b/string/string.h
index 7bb505f..83742ff 100644
--- a/string/string.h
+++ b/string/string.h
@@ -433,7 +433,7 @@ extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
 /* If a temporary buffer is required, at most BUFLEN bytes of BUF will be
    used.  */
 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
-     __THROW __nonnull ((2));
+     __THROW __nonnull ((2)) __wur;
 # endif
 #endif
 
-- 
1.7.3.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]