#include <assert.h>
#include <ctype.h>
+#include <errno.h>
#include <fcntl.h>
#include <gpgme.h>
#include <stdlib.h>
return 0;
}
+ // Log error message
+ const char* error = archive_error_string(*a);
+ DEBUG(archive->pakfire, "Could not open archive: %s\n", error);
+
archive_read_free(*a);
*a = NULL;
// Stat the file and store the result
int r = stat(archive->path, &archive->stat);
if (r) {
+ pakfire_errno = errno;
+
+ ERROR(pakfire, "Could not stat %s: %s\n",
+ archive->path, strerror(pakfire_errno));
+
goto error;
}
struct archive* a;
r = archive_open(archive, &a);
if (r) {
- pakfire_errno = r;
+ pakfire_errno = PAKFIRE_E_PKG_INVALID;
goto error;
}
// Parse all entries in the archive.
r = pakfire_archive_read_metadata(archive, a);
if (r) {
- pakfire_errno = r;
+ ERROR(pakfire, "Could not read metadata from %s\n", archive->path);
+
+ pakfire_errno = PAKFIRE_E_PKG_INVALID;
goto error;
}