Skip to content

Provide replacement function for strerror_l() #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ AC_CHECK_HEADERS([dlfcn.h string.h unistd.h sys/fcntl.h sys/ioctl.h linux/random
[LIBBLOCKDEV_SOFT_FAILURE([Header file $ac_header not found.])],
[])

AC_CHECK_FUNCS([strerror_l])

AC_ARG_WITH([bcache],
AS_HELP_STRING([--with-bcache], [support bcache @<:@default=yes@:>@]),
[],
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@

#define UNUSED __attribute__((unused))

#if !defined(HAVE_STRERROR_L)
static char *strerror_l(int errnum, locale_t locale UNUSED)
{
return strerror(errnum);
}
#endif

/**
* SECTION: crypto
* @short_description: plugin for operations with encrypted devices
Expand Down
8 changes: 8 additions & 0 deletions src/utils/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ gboolean bd_utils_unload_kernel_module (const gchar *module_name, GError **error
return TRUE;
}

#define UNUSED __attribute__((unused))

#if !defined(HAVE_STRERROR_L)
static char *strerror_l(int errnum, locale_t locale UNUSED)
{
return strerror(errnum);
}
#endif

static BDUtilsLinuxVersion detected_linux_ver;
static gboolean have_linux_ver = FALSE;
Expand Down