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>
This commit is contained in:
parent
8741551dc9
commit
7a3f59cd66
1 changed files with 1 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue