]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Move mtime update into result_get/manifest_get
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 6 Jun 2019 12:53:40 +0000 (14:53 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 6 Jun 2019 12:53:40 +0000 (14:53 +0200)
Housekeeping of cached files belongs to the backend code, not the
frontend.

src/ccache.c
src/manifest.c
src/result.c

index 249f1699dd6c0cc395ff0f2c8b081be68df1f7b7..e0288d9529795d216fa61f82a4e79d118e6386f7 100644 (file)
@@ -2062,7 +2062,6 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode)
                MTR_END("manifest", "manifest_get");
                if (object_hash) {
                        cc_log("Got object file hash from manifest");
-                       update_mtime(manifest_path);
                } else {
                        cc_log("Did not find object file hash in manifest");
                }
@@ -2174,10 +2173,6 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
 
        MTR_END("file", "file_get");
 
-       // Update modification timestamp to save files from LRU cleanup. Also gives
-       // files a sensible mtime when hard-linking.
-       update_mtime(cached_result);
-
        send_cached_stderr(tmp_stderr);
 
        if (put_object_in_manifest) {
index 9d614f94b3f5b258fd02bde980641f60cbcd2283..6672f402754815457fb1125ee9439877857734b7 100644 (file)
@@ -646,6 +646,10 @@ out:
        if (mf) {
                free_manifest(mf);
        }
+       if (fh) {
+               // Update modification timestamp to save files from LRU cleanup.
+               update_mtime(manifest_path);
+       }
        return fh;
 }
 
index 94bf6e2f7211468661de4b34e5c26321002b98a2..75ab420eeb541c4b5b25e01e2f1f5aae409afea5 100644 (file)
@@ -389,6 +389,10 @@ bool result_get(const char *path, struct filelist *list)
                cc_log("Error: %s", errmsg);
                free(errmsg);
        }
+       if (success) {
+               // Update modification timestamp to save files from LRU cleanup.
+               update_mtime(path);
+       }
        return success;
 }