summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Festi <ffesti@redhat.com>2019-02-25 13:10:33 +0100
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commit948d75645c9e534b5c043ef3c3ef9d5dc02bb695 (patch)
tree36cb6cf76beb7a969ce83ce285a5acdcff3d2c75
parent4b2c17e267502ea20a089bff31ba707a225d5f89 (diff)
downloadrpm-948d75645c9e534b5c043ef3c3ef9d5dc02bb695.tar.gz
rpm2archive: Fix file names for source rpms
rpm2archive previously just prepended a "." before the file name to get a local path. This works fine for absolute paths but not for bare file names as used in source rpms. Now we prepend "./" in these cases. Also use the calculated file name for hard links to avoid running into this issue twice. Resolves: #637 (cherry picked from commit ef422951aeb328c3274bc7b355bf8387306590f3)
-rw-r--r--rpm2archive.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/rpm2archive.c b/rpm2archive.c
index 198b99744..3b1a56559 100644
--- a/rpm2archive.c
+++ b/rpm2archive.c
@@ -21,8 +21,10 @@
static void fill_archive_entry(struct archive * a, struct archive_entry * entry, rpmfi fi)
{
archive_entry_clear(entry);
+ const char * dn = rpmfiDN(fi);
+ if (!strcmp(dn, "")) dn = "/";
- char * filename = rstrscat(NULL, ".", rpmfiDN(fi), rpmfiBN(fi), NULL);
+ char * filename = rstrscat(NULL, ".", dn, rpmfiBN(fi), NULL);
archive_entry_copy_pathname(entry, filename);
_free(filename);
@@ -153,7 +155,7 @@ static int process_package(rpmts ts, char * filename)
if (nlink > 1) {
if (rpmfiArchiveHasContent(fi)) {
_free(hardlink);
- hardlink = rstrscat(NULL, ".", rpmfiFN(fi), NULL);
+ hardlink = xstrdup(archive_entry_pathname(entry));
} else {
archive_entry_set_hardlink(entry, hardlink);
}