diff --git a/include/libzutil.h b/include/libzutil.h index d05d082a44f7..a7bef6b91fb2 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -276,13 +276,12 @@ _LIBZUTIL_H void update_vdev_config_dev_sysfs_path(nvlist_t *nv, * Thread-safe strerror() for use in ZFS libraries */ static inline char *zfs_strerror(int errnum) { - static __thread char errbuf[2048]; - static __thread pthread_mutex_t zfs_strerror_lock = - PTHREAD_MUTEX_INITIALIZER; + static __thread char errbuf[512]; + static pthread_mutex_t zfs_strerror_lock = PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_lock(&zfs_strerror_lock); - strlcpy(errbuf, strerror(errnum), sizeof(errbuf)); - pthread_mutex_unlock(&zfs_strerror_lock); + (void) pthread_mutex_lock(&zfs_strerror_lock); + (void) strlcpy(errbuf, strerror(errnum), sizeof(errbuf)); + (void) pthread_mutex_unlock(&zfs_strerror_lock); return errbuf; }