diff options
Diffstat (limited to 'main/apk-tools/0002-db-fix-refreshing-index-if-time-is-zero.patch')
-rw-r--r-- | main/apk-tools/0002-db-fix-refreshing-index-if-time-is-zero.patch | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/main/apk-tools/0002-db-fix-refreshing-index-if-time-is-zero.patch b/main/apk-tools/0002-db-fix-refreshing-index-if-time-is-zero.patch deleted file mode 100644 index 263bc71955..0000000000 --- a/main/apk-tools/0002-db-fix-refreshing-index-if-time-is-zero.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 258519b1cd32e285060fa4758c123b55ebfe3ef3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Thu, 5 Apr 2018 09:57:15 +0300 -Subject: [PATCH] db: fix refreshing index if time is zero - -During netboot on systems without RTC, time() will be near zero, -and the index fill not exist. Thus the plain test of st.st_mtime -against system time failed. Verify that fstatat() succeeds. ---- - src/database.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/database.c b/src/database.c -index 3976d3d..db34ed3 100644 ---- a/src/database.c -+++ b/src/database.c -@@ -634,9 +634,11 @@ int apk_cache_download(struct apk_database *db, struct apk_repository *repo, - r = apk_repo_format_real_url(db, repo, pkg, url, sizeof(url)); - if (r < 0) return r; - -- if (!(apk_force & APK_FORCE_REFRESH)) -- (void) fstatat(db->cache_fd, cacheitem, &st, 0); -- if (autoupdate && now - st.st_mtime <= db->cache_max_age) return -EALREADY; -+ if (autoupdate && !(apk_force & APK_FORCE_REFRESH)) { -+ if (fstatat(db->cache_fd, cacheitem, &st, 0) == 0 && -+ now - st.st_mtime <= db->cache_max_age) -+ return -EALREADY; -+ } - - apk_message("fetch %s", url); - --- -2.16.3 - |