int nrefs;
char path[PATH_MAX];
- struct stat stat;
// metadata
int format;
// Store path
pakfire_string_set(archive->path, path);
- // Stat the file and store the result
- int r = stat(archive->path, &archive->stat);
- if (r) {
- ERROR(archive->pakfire, "Could not stat %s: %s\n",
- archive->path, strerror(errno));
-
- goto ERROR;
- }
-
// Open the archive file for reading.
struct archive* a = NULL;
- r = archive_open(archive, &a);
+ int r = archive_open(archive, &a);
if (r)
goto ERROR;
}
PAKFIRE_EXPORT size_t pakfire_archive_get_size(PakfireArchive archive) {
- return archive->stat.st_size;
+ struct stat buf;
+
+ int r = stat(archive->path, &buf);
+ if (r) {
+ ERROR(archive->pakfire, "Could not stat %s: %s\n",
+ archive->path, strerror(errno));
+
+ return -1;
+ }
+
+ return buf.st_size;
}
/*