aboutsummaryrefslogtreecommitdiffstats
path: root/main/cryptsetup/strerror_r.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-12-18 14:08:33 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2014-12-18 14:11:10 +0100
commitd98d14163e40a9bbc90bb7ad84876ec069b94fdd (patch)
treeac4e10b6c0c006ebc7b5e06e520611afd0bfeaed /main/cryptsetup/strerror_r.patch
parent71f12447ac2a224d355ffad971d544ab9698aba0 (diff)
downloadaports-d98d14163e40a9bbc90bb7ad84876ec069b94fdd.tar.bz2
aports-d98d14163e40a9bbc90bb7ad84876ec069b94fdd.tar.xz
main/cryptsetup: fix segfault in error reporting
Problem is that strerror_r in glibc is non-conformat with POSIX. ref #3470 reported upstream: https://code.google.com/p/cryptsetup/issues/detail?id=237
Diffstat (limited to 'main/cryptsetup/strerror_r.patch')
-rw-r--r--main/cryptsetup/strerror_r.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/cryptsetup/strerror_r.patch b/main/cryptsetup/strerror_r.patch
new file mode 100644
index 0000000000..6dde3d514a
--- /dev/null
+++ b/main/cryptsetup/strerror_r.patch
@@ -0,0 +1,23 @@
+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);