X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=332ccd0f55c3072e1d9732546e055e1ecbed5f0e;hb=fdc0f3b646e417497849d4398029f780b0e5262f;hp=b3861887e2a204b404acb9c043f1c7302a7c32be;hpb=cef9175e52e8a240117b9f45b228fdaa0f1c0572;p=fio.git diff --git a/stat.c b/stat.c index b3861887..332ccd0f 100644 --- a/stat.c +++ b/stat.c @@ -1445,11 +1445,21 @@ static struct timeval status_time; static int check_status_file(void) { struct stat sb; + const char *temp_dir; + char fio_status_file_path[PATH_MAX]; - if (stat(FIO_STATUS_FILE, &sb)) + temp_dir = getenv("TMPDIR"); + if (temp_dir == NULL) + temp_dir = getenv("TEMP"); + if (temp_dir == NULL) + temp_dir = "/tmp"; + + snprintf(fio_status_file_path, sizeof(fio_status_file_path), "%s/%s", temp_dir, FIO_STATUS_FILE); + + if (stat(fio_status_file_path, &sb)) return 0; - unlink(FIO_STATUS_FILE); + unlink(fio_status_file_path); return 1; }