#include <openssl/evp.h>
#include <pakfire/archive.h>
-#include <pakfire/errno.h>
#include <pakfire/file.h>
#include <pakfire/filelist.h>
#include <pakfire/i18n.h>
if (strcmp(PAKFIRE_ARCHIVE_FN_FORMAT, entry_name) == 0) {
ret = pakfire_archive_parse_entry_format(archive, a, e);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
} else {
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
}
// If the format is set, we can go on...
if (strcmp(PAKFIRE_ARCHIVE_FN_METADATA, entry_name) == 0) {
ret = pakfire_archive_parse_entry_metadata(archive, a, e);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
// Parse the filelist
} else if (strcmp(PAKFIRE_ARCHIVE_FN_FILELIST, entry_name) == 0) {
ret = pakfire_archive_parse_entry_filelist(archive, a, e);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
// Parse the checksums
} else if (strcmp(PAKFIRE_ARCHIVE_FN_CHECKSUMS, entry_name) == 0) {
ret = pakfire_archive_parse_entry_checksums(archive, a, e);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
// Parse the scriptlets
} else if (pakfire_string_startswith(entry_name, "scriptlets/")) {
ret = pakfire_archive_parse_entry_scriptlet(archive, a, e, entry_name);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
}
}
// 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));
+ archive->path, strerror(errno));
goto error;
}
// Open the archive file for reading.
struct archive* a;
r = archive_open(archive, &a);
- if (r) {
- pakfire_errno = PAKFIRE_E_PKG_INVALID;
+ if (r)
goto error;
- }
// Parse all entries in the archive.
r = pakfire_archive_read_metadata(archive, a);
if (r) {
ERROR(pakfire, "Could not read metadata from %s\n", archive->path);
-
- pakfire_errno = PAKFIRE_E_PKG_INVALID;
goto error;
}
int r;
r = find_archive_entry(&entry, a, PAKFIRE_ARCHIVE_FN_PAYLOAD);
- if (r) {
- pakfire_errno = r;
+ if (r)
return NULL;
- }
struct archive* payload_archive;
r = payload_archive_open(&payload_archive, a);
- if (r) {
- pakfire_errno = r;
+ if (r)
return NULL;
- }
return payload_archive;
}
struct archive_entry* entry;
int r = archive_open(archive, &a);
- if (r) {
- pakfire_errno = r;
+ if (r)
goto out;
- }
int use_payload = (flags & PAKFIRE_ARCHIVE_USE_PAYLOAD);
struct archive* pa = NULL;
int r = archive_open(archive, &a);
- if (r) {
- pakfire_errno = r;
+ if (r)
return 1;
- }
int use_payload = (flags & PAKFIRE_ARCHIVE_USE_PAYLOAD);
if (strncmp(PAKFIRE_ARCHIVE_FN_SIGNATURES, entry_name, strlen(PAKFIRE_ARCHIVE_FN_SIGNATURES)) == 0) {
int ret = pakfire_archive_parse_entry_signature(archive, a, e);
if (ret)
- return PAKFIRE_E_PKG_INVALID;
+ return EINVAL;
}
return 0;
break;
if (r != ARCHIVE_OK) {
- pakfire_errno = r;
status = PAKFIRE_ARCHIVE_VERIFY_ERROR;
goto ERROR;
}
// Open the archive file
struct archive* a;
int r = archive_open(archive, &a);
- if (r) {
- pakfire_errno = r;
+ if (r)
return PAKFIRE_ARCHIVE_VERIFY_ERROR;
- }
struct archive_entry* entry;
while ((r = archive_read_next_header(a, &entry)) == ARCHIVE_OK) {