Skip to content

Commit 460e0bd

Browse files
committed
Use .cpio suffix for cpio output files
When creating cpio(5) archives, the generated file name should reflect that. Tested manually as the test suite redirects stdout whihc makes this a bit difficult to test. rpm2archive tries to output to stdout in this case. Resolves: rpm-software-management#3922
1 parent d3ed13a commit 460e0bd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tools/rpm2archive.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,21 @@ static int process_package(rpmts ts, const char * filename)
216216
} else {
217217
outname = rstrscat(NULL, filename, NULL);
218218
}
219-
if (compress) {
220-
outname = rstrscat(&outname, ".tgz", NULL);
221-
} else {
222-
outname = rstrscat(&outname, ".tar", NULL);
219+
220+
if (rstreq(format, "pax")) {
221+
if (compress) {
222+
outname = rstrscat(&outname, ".tgz", NULL);
223+
} else {
224+
outname = rstrscat(&outname, ".tar", NULL);
225+
}
226+
} else if (rstreq(format, "cpio")) {
227+
if (compress) {
228+
outname = rstrscat(&outname, ".cpio.gz", NULL);
229+
} else {
230+
outname = rstrscat(&outname, ".cpio", NULL);
231+
}
223232
}
233+
224234
if (archive_write_open_filename(a, outname) != ARCHIVE_OK) {
225235
fprintf(stderr, "Error: Can't open output file: %s\n", outname);
226236
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)