diff options
-rw-r--r-- | test/integration/framework | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/integration/framework b/test/integration/framework index ee976aff5..d52fcdf87 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -478,7 +478,6 @@ configdpkgnoopchroot() { #include <stdlib.h> #include <string.h> #include <dlfcn.h> -#include <limits.h> static char * chrootdir = NULL; @@ -495,16 +494,22 @@ int execvp(const char *file, char *const argv[]) { if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) return func_execvp(file, argv); printf("REWRITE execvp call %s into %s\n", file, chrootdir); - char newfile[PATH_MAX]; - snprintf(newfile, sizeof(newfile), "%s/%s", chrootdir, file); + char *newfile; + if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { + perror("asprintf"); + return -1; + } char const * const baseadmindir = "/var/lib/dpkg"; - char admindir[PATH_MAX]; - snprintf(admindir, sizeof(admindir), "%s/%s", chrootdir, baseadmindir); + char *admindir; + if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { + perror("asprintf"); + return -1; + } setenv("DPKG_ADMINDIR", admindir, 1); return func_execvp(newfile, argv); } EOF - testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl + testsuccess --nomsg gcc -Wall -fPIC -shared -o noopchroot.so noopchroot.c -ldl } configcompression() { while [ -n "$1" ]; do |