From 9dde80065fa09128885d61b0a3baaec780961880 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Thu, 19 Oct 2017 15:50:46 +0100 Subject: [PATCH] test: Fix trivial compiler warning in dlwrap This mutes compiler warnings for `dlwrap.c` by ensuring we actually check the return status of the `asprintf` call. At this point in the test suite our possible failure here is only memory, so we'll abort. Signed-off-by: Ikey Doherty --- test/dlwrap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/dlwrap.c b/test/dlwrap.c index c5d447b..60866db 100644 --- a/test/dlwrap.c +++ b/test/dlwrap.c @@ -162,7 +162,11 @@ wrapped_dlsym(const char *prefix, const char *name) char *wrap_name; void *symbol; - asprintf(&wrap_name, "override_%s_%s", prefix, name); + if (asprintf(&wrap_name, "override_%s_%s", prefix, name) < 0) { + fputs("Error: Failed to allocate memory.\n", stderr); + abort(); + } + symbol = dlwrap_real_dlsym(RTLD_DEFAULT, wrap_name); free(wrap_name); return symbol;