Skip to content

Commit 1e83bf5

Browse files
kevans91bapt
authored andcommitted
libpkg: correctly re-fetch meta.conf if it's missing
pkg_repo_binary_update currently passes along the timestamp of the database if the meta.conf is missing, but this is slightly incorrect: if the meta.conf is missing but we pass in the timestamp of the database, we may get an incorrect EPKG_UPTODATE because we do not realize that work does need to be done. Fix it by moving the got_meta check up one if() to avoid the stat call if we don't have the .meta, forcing the refetch. Signed-off-by: Kyle Evans <[email protected]>
1 parent 9cab8d6 commit 1e83bf5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libpkg/repo/binary/update.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ pkg_repo_binary_update(struct pkg_repo *repo, bool force)
624624

625625
snprintf(filepath, sizeof(filepath), "%s/%s", ctx.dbdir,
626626
pkg_repo_binary_get_filename(pkg_repo_name(repo)));
627-
if (stat(filepath, &st) != -1) {
628-
if (!got_meta && !force)
627+
if (got_meta && stat(filepath, &st) != -1) {
628+
if (!force)
629629
t = st.st_mtime;
630630
}
631631
}

0 commit comments

Comments
 (0)