summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/gzip.c4
-rw-r--r--archival/rpm.c3
2 files changed, 2 insertions, 5 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index 37fefbf..ad2c24d 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1212,9 +1212,7 @@ int gzip_main(int argc, char **argv)
time_stamp = statBuf.st_ctime;
if (!tostdout) {
- path = xmalloc(strlen(argv[i]) + 4);
- strcpy(path, argv[i]);
- strcat(path, ".gz");
+ path = xasprintf("%s.gz", argv[i]);
/* Open output file */
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) && defined O_NOFOLLOW
diff --git a/archival/rpm.c b/archival/rpm.c
index d399e0e..a459839 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -290,8 +290,7 @@ static void fileaction_dobackup(char *filename, int fileref)
if (rpm_getint(RPMTAG_FILEFLAGS, fileref) & RPMFILE_CONFIG) { /* Only need to backup config files */
stat_res = lstat (filename, &oldfile);
if (stat_res == 0 && S_ISREG(oldfile.st_mode)) { /* File already exists - really should check MD5's etc to see if different */
- newname = xstrdup(filename);
- newname = strcat(newname, ".rpmorig");
+ newname = xasprintf("%s.rpmorig", filename);
copy_file(filename, newname, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS);
remove_file(filename, FILEUTILS_RECUR | FILEUTILS_FORCE);
free(newname);