Skip to content

Commit a6facb5

Browse files
committed
chore: move time into the loop
1 parent 5a65c96 commit a6facb5

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

ext/session/mod_files.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,6 @@ static int ps_files_cleanup_dir(const zend_string *dirname, zend_long maxlifetim
304304
memcpy(buf, ZSTR_VAL(dirname), ZSTR_LEN(dirname));
305305
buf[ZSTR_LEN(dirname)] = PHP_DIR_SEPARATOR;
306306

307-
/* Only read the clock when we are about to compare mtimes at target depth */
308-
if (remaining_depth == 0) {
309-
time(&now);
310-
}
311-
312307
while ((entry = readdir(dir))) {
313308
/* skip . and .. */
314309
if (entry->d_name[0] == '.' &&
@@ -333,6 +328,7 @@ static int ps_files_cleanup_dir(const zend_string *dirname, zend_long maxlifetim
333328
if (VCWD_STAT(buf, &sbuf) != 0) {
334329
continue;
335330
}
331+
time(&now);
336332
if ((now - sbuf.st_mtime) > maxlifetime) {
337333
VCWD_UNLINK(buf);
338334
nrdels++;

0 commit comments

Comments
 (0)