mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
errno-util: return const string from strerror_safe()
C's strerror() function does not return a "const char *" pointer for the string. That has historic reasons and C99 even comments that "[t]he array pointed to shall not be modified by the program". Make the strerror_safe() wrapper correct this and be more strict in this regard.
This commit is contained in:
parent
17f8fd9cf7
commit
6fd79cca68
@ -31,7 +31,7 @@ static inline int negative_errno(void) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
static inline char *strerror_safe(int error) {
|
||||
static inline const char *strerror_safe(int error) {
|
||||
/* 'safe' here does NOT mean thread safety. */
|
||||
return strerror(abs(error));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user