diff options
Diffstat (limited to 'src/install.c')
-rw-r--r-- | src/install.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/install.c b/src/install.c index 1fb4513..7d41b36 100644 --- a/src/install.c +++ b/src/install.c @@ -63,8 +63,16 @@ int install(const char *destroot, const char *_package) { char cwd[PATH_MAX]; char source[PATH_MAX]; char template[PATH_MAX]; - char suffix[PATH_MAX] = "spm_destroot_XXXXXX"; - sprintf(template, "%s%c%s", TMP_DIR, DIRSEP, suffix); + + // circumvent -Wformat-truncation + char *suffix = (char *) calloc(PATH_MAX, sizeof(char)); + if (!suffix) { + perror("suffix"); + fprintf(SYSERROR); + } + strcpy(suffix, "spm_destroot_XXXXXX"); + snprintf(template, PATH_MAX, "%s%c%s", TMP_DIR, DIRSEP, suffix); + free(suffix); // Create a new temporary directory and extract the requested package into it char *tmpdir = mkdtemp(template); |