summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorK. Piche <kevin@archlinux.org>2008-04-09 05:30:46 +0200
committerDan McGee <dan@archlinux.org>2008-04-15 00:19:32 +0200
commitdb4258c1fdf27708968baf9c4e730a014af40fd8 (patch)
tree0e5ec59935c34b6d76c65e7989eb387afc171bfc /lib
parent9f561370348ce44b2a5453ba63a8bf405c69e6f3 (diff)
downloadpacman-db4258c1fdf27708968baf9c4e730a014af40fd8.tar.gz
pacman-db4258c1fdf27708968baf9c4e730a014af40fd8.tar.xz
Some comments for _alpm_unpack.
Signed-off-by: K. Piche <kevin@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 9d86331b..9f431ed7 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -370,6 +370,13 @@ int _alpm_lckrm()
/* Compression functions */
+/**
+ * @brief Unpack a specific file or all files in an archive.
+ *
+ * @param archive the archive to unpack
+ * @param prefix where to extract the files
+ * @param fn a file within the archive to unpack or NULL for all
+ */
int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
{
int ret = 1;
@@ -407,13 +414,17 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
archive_entry_set_mode(entry, 0755);
}
+ /* If a specific file was requested skip entries that don't match. */
if (fn && strcmp(fn, entryname)) {
+ _alpm_log(PM_LOG_DEBUG, "skipping: %s\n", entryname);
if (archive_read_data_skip(_archive) != ARCHIVE_OK) {
ret = 1;
goto cleanup;
}
continue;
}
+
+ /* Extract the archive entry. */
ret = 0;
snprintf(expath, PATH_MAX, "%s/%s", prefix, entryname);
archive_entry_set_pathname(entry, expath);