xbps-create: remove mmap to load files to archive.
This commit is contained in:
parent
30d1d0f607
commit
35fa3b5808
@ -526,8 +526,9 @@ static void
|
|||||||
write_entry(struct archive *ar, struct archive_entry *entry)
|
write_entry(struct archive *ar, struct archive_entry *entry)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
char *mmf;
|
int fd;
|
||||||
size_t mmflen, filelen;
|
char buf[65536];
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
if (archive_entry_pathname(entry) == NULL)
|
if (archive_entry_pathname(entry) == NULL)
|
||||||
return;
|
return;
|
||||||
@ -546,11 +547,16 @@ write_entry(struct archive *ar, struct archive_entry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = archive_entry_sourcepath(entry);
|
name = archive_entry_sourcepath(entry);
|
||||||
if (!xbps_mmap_file(name, (void *)&mmf, &mmflen, &filelen))
|
|
||||||
die("cannot read %s file", name);
|
|
||||||
|
|
||||||
archive_write_data(ar, mmf, filelen);
|
if ((fd = open(name, O_RDONLY)) < 0)
|
||||||
(void)munmap(mmf, mmflen);
|
die("cannot open %s file", name);
|
||||||
|
while ((len = read(fd, buf, sizeof(buf))) > 0)
|
||||||
|
archive_write_data(ar, buf, len);
|
||||||
|
(void)close(fd);
|
||||||
|
|
||||||
|
if(len < 0)
|
||||||
|
die("cannot open %s file", name);
|
||||||
|
|
||||||
archive_entry_free(entry);
|
archive_entry_free(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user