Don't use stack allocations in rpm2cpio when not needed
authorJindrich Novy <jnovy@redhat.com>
Wed, 9 Apr 2008 11:05:45 +0000 (13:05 +0200)
committerJindrich Novy <jnovy@redhat.com>
Wed, 9 Apr 2008 14:03:17 +0000 (16:03 +0200)
rpm2cpio.c

index b18133d..05ff8e9 100644 (file)
@@ -66,17 +66,14 @@ int main(int argc, char *argv[])
 
     /* Retrieve type of payload compression. */
     {  const char * payload_compressor = NULL;
-       char * t;
 
        if (!headerGetEntry(h, RPMTAG_PAYLOADCOMPRESSOR, NULL,
                            (rpm_data_t *) &payload_compressor, NULL))
            payload_compressor = "gzip";
-       rpmio_flags = t = alloca(sizeof("r.gzdio"));
-       *t++ = 'r';
        if (!strcmp(payload_compressor, "gzip"))
-           t = stpcpy(t, ".gzdio");
+           rpmio_flags = "r.gzdio";
        if (!strcmp(payload_compressor, "bzip2"))
-           t = stpcpy(t, ".bzdio");
+           rpmio_flags = "r.bzdio";
     }
 
     gzdi = Fdopen(fdi, rpmio_flags);   /* XXX gzdi == fdi */