Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Turn packing_finish into a regular cleanup function
Baptiste Daroussin committed 11 years ago
commit 8443beb43437714ac78e8916bfa2bb5f1cdbdf7d
parent 6673c98
4 files changed +14 -11
modified libpkg/packing.c
@@ -330,10 +330,11 @@ cleanup:
	return EPKG_OK;
}

-
int
+
void
packing_finish(struct packing *pack)
{
-
	assert(pack != NULL);
+
	if (pack == NULL)
+
		return;

	archive_read_close(pack->aread);
	archive_read_free(pack->aread);
@@ -342,8 +343,6 @@ packing_finish(struct packing *pack)
	archive_write_free(pack->awrite);

	free(pack);
-

-
	return (EPKG_OK);
}

static const char *
modified libpkg/pkg.c
@@ -1693,7 +1693,9 @@ pkg_copy_tree(struct pkg *pkg, const char *src, const char *dest)
		    file->uname, file->gname, file->perm);
	}

-
	return (packing_finish(pack));
+
	packing_finish(pack);
+

+
	return (EPKG_OK);
}

int
modified libpkg/pkg_create.c
@@ -270,8 +270,8 @@ pkg_create_from_manifest(const char *outdir, pkg_formats format,
cleanup:
	free(pkg);
	pkg_manifest_keys_free(keys);
-
	if (ret == EPKG_OK)
-
		ret = packing_finish(pkg_archive);
+
	packing_finish(pkg_archive);
+

	return (ret);
}

@@ -389,8 +389,8 @@ cleanup:
	free(pkg);
	free(manifest);
	pkg_manifest_keys_free(keys);
-
	if (ret == EPKG_OK)
-
		ret = packing_finish(pkg_archive);
+
	packing_finish(pkg_archive);
+

	return (ret);
}

@@ -413,7 +413,9 @@ pkg_create_installed(const char *outdir, pkg_formats format, struct pkg *pkg)

	pkg_create_from_dir(pkg, NULL, pkg_archive);

-
	return packing_finish(pkg_archive);
+
	packing_finish(pkg_archive);
+

+
	return (EPKG_OK);
}

static int64_t	count;
modified libpkg/private/pkg.h
@@ -583,7 +583,7 @@ int packing_append_buffer(struct packing *pack, const char *buffer,
			  const char *path, int size);
int packing_append_tree(struct packing *pack, const char *treepath,
			const char *newroot);
-
int packing_finish(struct packing *pack);
+
void packing_finish(struct packing *pack);
pkg_formats packing_format_from_string(const char *str);
const char* packing_format_to_string(pkg_formats format);