diff options
-rw-r--r-- | Build/source/texk/dvipdfmx/src/dpxfile.c | 11 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dpxfile.c | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Build/source/texk/dvipdfmx/src/dpxfile.c b/Build/source/texk/dvipdfmx/src/dpxfile.c index 8aa77d00d20..d6390641ed0 100644 --- a/Build/source/texk/dvipdfmx/src/dpxfile.c +++ b/Build/source/texk/dvipdfmx/src/dpxfile.c @@ -871,16 +871,21 @@ dpx_clear_cache_filter (const struct dirent *ent) { void dpx_delete_old_cache (int life) { - const char *dir = dpx_get_tmpdir(); - char *pathname = NEW(strlen(dir)+1+strlen(PREFIX)+MAX_KEY_LEN*2 + 1, char); + const char *dir; + char *pathname; DIR *dp; struct dirent *de; - time_t limit = time(NULL) - life * 60 * 60; + time_t limit; if (life == -2) { keep_cache = -1; return; } + + dir = dpx_get_tmpdir(); + pathname = NEW(strlen(dir)+1+strlen(PREFIX)+MAX_KEY_LEN*2 + 1, char); + limit = time(NULL) - life * 60 * 60; + if (life >= 0) keep_cache = 1; if ((dp = opendir(dir)) != NULL) { while((de = readdir(dp)) != NULL) { diff --git a/Build/source/texk/xdvipdfmx/src/dpxfile.c b/Build/source/texk/xdvipdfmx/src/dpxfile.c index b904bea8055..a0b124c722e 100644 --- a/Build/source/texk/xdvipdfmx/src/dpxfile.c +++ b/Build/source/texk/xdvipdfmx/src/dpxfile.c @@ -893,16 +893,21 @@ dpx_clear_cache_filter (const struct dirent *ent) { void dpx_delete_old_cache (int life) { - const char *dir = dpx_get_tmpdir(); - char *pathname = NEW(strlen(dir)+1+strlen(PREFIX)+MAX_KEY_LEN*2 + 1, char); + const char *dir; + char *pathname; DIR *dp; struct dirent *de; - time_t limit = time(NULL) - life * 60 * 60; + time_t limit; if (life == -2) { keep_cache = -1; return; } + + dir = dpx_get_tmpdir(); + pathname = NEW(strlen(dir)+1+strlen(PREFIX)+MAX_KEY_LEN*2 + 1, char); + limit = time(NULL) - life * 60 * 60; + if (life >= 0) keep_cache = 1; if ((dp = opendir(dir)) != NULL) { while((de = readdir(dp)) != NULL) { |