From 9cac521f07550764e94c469d70b22ad5c194855a Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 9 Sep 2006 12:24:19 +0000 Subject: using [xa]sprintf for string concatenation is neat and saves ~100 bytes according to bloatcheck. Also this fixes bug in rpm --- archival/gzip.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'archival/gzip.c') 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) 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 -- cgit v1.2.3