utils: Move thread-safe strerror replacement to a separate file
For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3).
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "enum.h"
|
||||
#include "utils/strerror.h"
|
||||
|
||||
/**
|
||||
* strongSwan program return codes
|
||||
@@ -494,23 +495,6 @@ char *strreplace(const char *str, const char *search, const char *replace);
|
||||
*/
|
||||
bool mkdir_p(const char *path, mode_t mode);
|
||||
|
||||
/**
|
||||
* Thread-safe wrapper around strerror and strerror_r.
|
||||
*
|
||||
* This is required because the first is not thread-safe (on some platforms)
|
||||
* and the second uses two different signatures (POSIX/GNU) and is impractical
|
||||
* to use anyway.
|
||||
*
|
||||
* @param errnum error code (i.e. errno)
|
||||
* @return error message
|
||||
*/
|
||||
const char *safe_strerror(int errnum);
|
||||
|
||||
/**
|
||||
* Replace usages of strerror(3) with thread-safe variant.
|
||||
*/
|
||||
#define strerror(errnum) safe_strerror(errnum)
|
||||
|
||||
#ifndef HAVE_CLOSEFROM
|
||||
/**
|
||||
* Close open file descriptors greater than or equal to lowfd.
|
||||
|
||||
Reference in New Issue
Block a user