-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add utility function nl_strerror_l()
libnl currently uses strerror_r() throughout, but this is problematic because there is a non-standard GNU version implemented in glibc, and the standard POSIX version, which differ in signature. When using glibc, one can choose between the two versions using feature test macros _GNU_SOURCE and _POSIX_C_SOURCE. Given libnl is built using the former, we always get the glibc special version, and all code so far has been written for that non-standard version. Other C libraries like musl on the other hand only try to be posix compliant, and only ever provide the posix version of strerror_r(), which has a different signature. The alternative is to use strerror_l() rather than strerror_r() http://austingroupbugs.net/view.php?id=655 - this will avoid the non-confirming versions issue - strerror_l() is now recommended by POSIX to replace strerror_r() usage So rather than changing all uses of strerror_r() to be in line with posix, we are going to switch to the recommended interface strerror_l(). Since strerror_l() is slightly more difficuly to use, we add a little (private) wrapper that we can use from all current callsites of strerror_r(). Signed-off-by: André Draszik <adraszik@tycoint.com> Reviewed-by: Stephane Ayotte <sayotte@tycoint.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* netlink-private/utils.h Local Utility Functions | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation version 2.1 | ||
* of the License. | ||
* | ||
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch> | ||
*/ | ||
|
||
#ifndef NETLINK_UTILS_PRIV_H_ | ||
#define NETLINK_UTILS_PRIV_H_ | ||
|
||
extern const char * nl_strerror_l(int err); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters