Closed GoogleCodeExporter closed 9 years ago
The problem is that cryptsetup assumes GNU behavior of strerror_r:
int strerror_r(int errnum, char *buf, size_t buflen);
/* XSI-compliant */
char *strerror_r(int errnum, char *buf, size_t buflen);
/* GNU-specific */
While musl only implement the XSI-compliant version.
Original comment by natanael...@gmail.com
on 17 Dec 2014 at 8:38
Possible fix:
diff --git a/src/utils_tools.c b/src/utils_tools.c
index 4e8b0b4..1b4f3e5 100644
--- a/src/utils_tools.c
+++ b/src/utils_tools.c
@@ -176,11 +176,18 @@ void show_status(int errcode)
crypt_get_error(error, sizeof(error));
if (!error[0]) {
+#if defined(__GLIBC__)
+ /* GNU libc strerror_r is non-portable. */
error_ = strerror_r(-errcode, error, sizeof(error));
if (error_ != error) {
strncpy(error, error_, sizeof(error));
error[sizeof(error) - 1] = '\0';
}
+#else
+ /* POSIX variant */
+ if (strerror_r(-errcode, error, sizeof(error)) != 0)
+ error[0] = '\0';
+#endif
}
log_err(_("Command failed with code %i"), -errcode);
Original comment by natanael...@gmail.com
on 18 Dec 2014 at 1:08
Yes, we will need some wrapper for this, thanks.
Will fix this in next release.
Original comment by gmazyl...@gmail.com
on 18 Dec 2014 at 4:22
Fix (using autoconf macro) committed in
https://code.google.com/p/cryptsetup/source/detail?r=e24a72f84ca996787169a0128b5
c560e3548aac0
Thanks!
Original comment by gmazyl...@gmail.com
on 10 Jan 2015 at 7:40
Original issue reported on code.google.com by
natanael...@gmail.com
on 17 Dec 2014 at 8:35