Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
HBSD: Unbreak handling of symlinks
Shawn Webb committed 5 years ago
commit cec7452832a0d52a2cb9f34fcc8c7beb187fd9cc
parent a5e9d61
1 file changed +5 -5
modified libpkg/packing.c
@@ -233,6 +233,11 @@ packing_append_file_attr(struct packing *pack, const char *filepath,
	if (sparse_entry != NULL && entry == NULL)
		entry = sparse_entry;

+
	if (archive_entry_size(entry) <= 0) {
+
		archive_write_header(pack->awrite, entry);
+
		goto cleanup;
+
	}
+

	if ((fd = open(filepath, O_RDONLY)) < 0) {
		pkg_emit_errno("open", filepath);
		retcode = EPKG_FATAL;
@@ -243,11 +248,6 @@ packing_append_file_attr(struct packing *pack, const char *filepath,

	archive_write_header(pack->awrite, entry);

-
	if (archive_entry_size(entry) <= 0) {
-
		close(fd);
-
		goto cleanup;
-
	}
-

	while ((len = read(fd, buf, sizeof(buf))) > 0) {
		if (archive_write_data(pack->awrite, buf, len) == -1) {
			pkg_emit_errno("archive_write_data", "archive write error");