From 8bbb5dd0789db6d57f1fc365296ef0f6a35e8a1f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 29 Apr 2007 12:47:02 -0400 Subject: libalpm util.c and util.h cleanup * Remove some unnecessary conditional compiling in util.h- move the functions tha required it to trans.c (along with a bunch of new header includes). * Clean up util.h a bit- remove some header includes, remove universal libarchive include and only put it in the files that need it. Signed-off-by: Dan McGee --- lib/libalpm/add.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 49385f4f..73c84cc0 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -39,6 +39,10 @@ #include #include +/* libarchive */ +#include +#include + /* libalpm */ #include "add.h" #include "alpm_list.h" @@ -280,6 +284,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) return(0); } +/* TODO clean up this monster 554 line function */ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) { int i, ret = 0, errors = 0, pkg_count = 0; @@ -287,6 +292,9 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) struct archive_entry *entry; char cwd[PATH_MAX] = ""; alpm_list_t *targ, *lp; + const int archive_flags = ARCHIVE_EXTRACT_OWNER | + ARCHIVE_EXTRACT_PERM | + ARCHIVE_EXTRACT_TIME; ALPM_LOG_FUNC; @@ -536,9 +544,11 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) archive_entry_set_pathname(entry, tempfile); - if(archive_read_extract(archive, entry, ARCHIVE_EXTRACT_FLAGS) != ARCHIVE_OK) { - _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), entryname, strerror(errno)); - alpm_logaction(_("could not extract %s (%s)"), entryname, strerror(errno)); + if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) { + _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), + entryname, strerror(errno)); + alpm_logaction(_("could not extract %s (%s)"), + entryname, strerror(errno)); errors++; unlink(tempfile); FREE(hash_orig); @@ -686,7 +696,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) archive_entry_set_pathname(entry, filename); - if(archive_read_extract(archive, entry, ARCHIVE_EXTRACT_FLAGS) != ARCHIVE_OK) { + if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) { _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), filename, strerror(errno)); alpm_logaction(_("error: could not extract %s (%s)"), filename, strerror(errno)); errors++; -- cgit v1.2.3-70-g09d2