summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-02-11 16:17:59 +1000
committerDan McGee <dan@archlinux.org>2012-02-13 10:03:05 -0600
commit7a3f59cd66a4f70641b863ebaaf52674b921bf3c (patch)
tree7c1435bb6067545353e949a811983ec7b972c88f /lib
parent8741551dc94d506df72b5ae8453bca1e4d50dbab (diff)
Reset errno before opening archive
Set errno to 0 at the start of _alpm_open_archive as it is not set when archive_read_open_fd fails. This can result in _alpm_pkg_load_internal thinking errno == ENOENT and setting the wrong pm_errno. e.g. Before: > testpkg pacman-4.0.1-4-i686.pkg.tar.gz.sig error: could not open file pacman-4.0.1-4-i686.pkg.tar.gz.sig: Unrecognized archive format Cannot find the given file. After: > testpkg pacman-4.0.1-4-i686.pkg.tar.gz.sig error: could not open file pacman-4.0.1-4-i686.pkg.tar.gz.sig: Unrecognized archive format Cannot open the given file. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/util.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 11285896..59861242 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -227,6 +227,7 @@ int _alpm_open_archive(alpm_handle_t *handle, const char *path,
{
int fd;
size_t bufsize = ALPM_BUFFER_SIZE;
+ errno = 0;
if((*archive = archive_read_new()) == NULL) {
RET_ERR(handle, ALPM_ERR_LIBARCHIVE, -1);