diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/liburing/0001-Add-custom-error-function-for-tests.patch')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/liburing/0001-Add-custom-error-function-for-tests.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/liburing/0001-Add-custom-error-function-for-tests.patch b/nixpkgs/pkgs/development/libraries/liburing/0001-Add-custom-error-function-for-tests.patch new file mode 100644 index 000000000000..191f6ae8cd5a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/liburing/0001-Add-custom-error-function-for-tests.patch @@ -0,0 +1,66 @@ +From d4714fd7aac9c5f499c406703bc437dc6cf72ef3 Mon Sep 17 00:00:00 2001 +From: Steffen <steffen.winter@proton.me> +Date: Mon, 13 Feb 2023 17:32:16 +0100 +Subject: [PATCH 1/3] Add custom error function for tests. + +On musl systems, liburing cannot build examples and tests due to +it's usage of error.h. t_error calls fprintf(stderr, ...) and +exits. + +Closes: #786 + +Signed-off-by: Steffen Winter <steffen.winter@proton.me> +--- + test/helpers.c | 18 ++++++++++++++++++ + test/helpers.h | 2 ++ + 2 files changed, 20 insertions(+) + +diff --git a/test/helpers.c b/test/helpers.c +index 8fb32b8..caa887e 100644 +--- a/test/helpers.c ++++ b/test/helpers.c +@@ -8,6 +8,7 @@ + #include <stdio.h> + #include <fcntl.h> + #include <unistd.h> ++#include <stdarg.h> + #include <sys/types.h> + + #include <arpa/inet.h> +@@ -266,3 +267,20 @@ bool t_probe_defer_taskrun(void) + io_uring_queue_exit(&ring); + return true; + } ++ ++/* ++ * Implementation of error(3), prints an error message and exits. ++ */ ++void t_error(int status, int errnum, const char *format, ...) ++{ ++ va_list args; ++ va_start(args, format); ++ ++ vfprintf(stderr, format, args); ++ if (errnum) ++ fprintf(stderr, ": %s", strerror(errnum)); ++ ++ fprintf(stderr, "\n"); ++ va_end(args); ++ exit(status); ++} +diff --git a/test/helpers.h b/test/helpers.h +index 4375a9e..33b82cf 100644 +--- a/test/helpers.h ++++ b/test/helpers.h +@@ -87,6 +87,8 @@ bool t_probe_defer_taskrun(void); + + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + ++void t_error(int status, int errnum, const char *format, ...); ++ + #ifdef __cplusplus + } + #endif +-- +2.39.1 + |