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 <ikey@solus-project.com>
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 @@
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;