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>
macos/v1.5.9
Ikey Doherty 7 years ago
parent 1b54e263eb
commit 9dde80065f
No known key found for this signature in database
GPG Key ID: 78E2387015C1205F
  1. 6
      test/dlwrap.c

@ -162,7 +162,11 @@ wrapped_dlsym(const char *prefix, const char *name)
char *wrap_name; char *wrap_name;
void *symbol; 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); symbol = dlwrap_real_dlsym(RTLD_DEFAULT, wrap_name);
free(wrap_name); free(wrap_name);
return symbol; return symbol;

Loading…
Cancel
Save