// Open the archive file
struct archive* a = open_archive(archive, NULL);
if (!a)
- return 1;
+ return -errno;
// Walk through the archive
r = pakfire_walk(archive->pakfire, a, callback, filter_callback, data);
default:
ERROR(archive->pakfire, "This version of Pakfire does not support "
"archive format %d\n", archive->format);
- return -EINVAL;
+ return -ENOTSUP;
}
DEBUG(archive->pakfire, "Archive format is %d\n", archive->format);
// Check if we could successfully read something
if (!archive->format) {
ERROR(archive->pakfire, "Archive has an unknown format\n");
- return -EINVAL;
+ return -ENOMSG;
}
// Check if we have read some metadata
if (!archive->metadata) {
ERROR(archive->pakfire, "Archive has no metadata\n");
- return -EINVAL;
+ return -ENOMSG;
}
return 0;
// Open the file (and keep the file descriptor open)
archive->f = fopen(archive->path, "r");
if (!archive->f)
- return 1;
+ return -errno;
// Let the kernel know, that we will read the file sequentially
r = posix_fadvise(fileno(archive->f), 0, 0, POSIX_FADV_SEQUENTIAL);
// Read all package metadata
r = pakfire_archive_read_metadata(archive);
if (r) {
- ERROR(archive->pakfire, "Could not open archive: %m\n");
+ ERROR_ERRNO(archive->pakfire, r, "Could not open archive: %m\n");
goto ERROR;
}