Skip to content

Commit 1cc9e20

Browse files
committed
Fallback to strerror() when strerror_l() isn't available
Some C libraries, such as uClibc, do not provide strerror_l() in which case we fallback to strerror(). Signed-off-by: Brian Behlendorf <[email protected]>
1 parent 34efa8e commit 1cc9e20

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

config/user.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
3333
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
3434
ZFS_AC_CONFIG_USER_ZFSEXEC
3535
36-
AC_CHECK_FUNCS([execvpe issetugid mlockall strlcat strlcpy gettid])
36+
AC_CHECK_FUNCS([execvpe issetugid mlockall strerror_l strlcat strlcpy gettid])
3737
3838
AC_SUBST(RM)
3939
])

include/libzutil.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ _LIBZUTIL_H void update_vdev_config_dev_sysfs_path(nvlist_t *nv,
276276
* Thread-safe strerror() for use in ZFS libraries
277277
*/
278278
static inline char *zfs_strerror(int errnum) {
279+
#ifdef HAVE_STRERROR_L
279280
return (strerror_l(errnum, uselocale(0)));
281+
#else
282+
return (strerror(errnum));
283+
#endif
280284
}
281285

282286
#ifdef __cplusplus

0 commit comments

Comments
 (0)