aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-09 12:24:19 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-09 12:24:19 +0000
commit9cac521f07550764e94c469d70b22ad5c194855a (patch)
tree98f3e605a5b17bffc9e1f087907bf15049d6e717 /archival
parent3526a1320a7e70be0def06a31b65ffff3430510b (diff)
downloadbusybox-w32-9cac521f07550764e94c469d70b22ad5c194855a.tar.gz
busybox-w32-9cac521f07550764e94c469d70b22ad5c194855a.tar.bz2
busybox-w32-9cac521f07550764e94c469d70b22ad5c194855a.zip
using [xa]sprintf for string concatenation is neat and saves
~100 bytes according to bloatcheck. Also this fixes bug in rpm
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 37fefbf6a..ad2c24df1 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1212,9 +1212,7 @@ int gzip_main(int argc, char **argv)
1212 time_stamp = statBuf.st_ctime; 1212 time_stamp = statBuf.st_ctime;
1213 1213
1214 if (!tostdout) { 1214 if (!tostdout) {
1215 path = xmalloc(strlen(argv[i]) + 4); 1215 path = xasprintf("%s.gz", argv[i]);
1216 strcpy(path, argv[i]);
1217 strcat(path, ".gz");
1218 1216
1219 /* Open output file */ 1217 /* Open output file */
1220#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) && defined O_NOFOLLOW 1218#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) && defined O_NOFOLLOW
diff --git a/archival/rpm.c b/archival/rpm.c
index d399e0ea2..a459839d9 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -290,8 +290,7 @@ static void fileaction_dobackup(char *filename, int fileref)
290 if (rpm_getint(RPMTAG_FILEFLAGS, fileref) & RPMFILE_CONFIG) { /* Only need to backup config files */ 290 if (rpm_getint(RPMTAG_FILEFLAGS, fileref) & RPMFILE_CONFIG) { /* Only need to backup config files */
291 stat_res = lstat (filename, &oldfile); 291 stat_res = lstat (filename, &oldfile);
292 if (stat_res == 0 && S_ISREG(oldfile.st_mode)) { /* File already exists - really should check MD5's etc to see if different */ 292 if (stat_res == 0 && S_ISREG(oldfile.st_mode)) { /* File already exists - really should check MD5's etc to see if different */
293 newname = xstrdup(filename); 293 newname = xasprintf("%s.rpmorig", filename);
294 newname = strcat(newname, ".rpmorig");
295 copy_file(filename, newname, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS); 294 copy_file(filename, newname, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS);
296 remove_file(filename, FILEUTILS_RECUR | FILEUTILS_FORCE); 295 remove_file(filename, FILEUTILS_RECUR | FILEUTILS_FORCE);
297 free(newname); 296 free(newname);