filelock: fix segfault on some use cases of log file locking
[fio.git] / backend.c
index 7c6fc9b0478818d3443bf3c84554dfc090f24087..efabfa79f9a66fe42b0d7270122bb44b795d7dce 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -432,7 +432,7 @@ static int wait_for_completions(struct thread_data *td, struct timeval *time,
        if (full && !min_evts)
                min_evts = 1;
 
-       if (time && (should_check_rate(td, DDIR_READ) ||
+       if (time && (__should_check_rate(td, DDIR_READ) ||
            __should_check_rate(td, DDIR_WRITE) ||
            __should_check_rate(td, DDIR_TRIM)))
                fio_gettime(time, NULL);
@@ -2109,7 +2109,8 @@ static void *helper_thread_main(void *data)
                gettimeofday(&tv, NULL);
                ts.tv_sec = tv.tv_sec + sec;
                ts.tv_nsec = (tv.tv_usec * 1000) + nsec;
-               if (ts.tv_nsec > 1000000000ULL) {
+
+               if (ts.tv_nsec >= 1000000000ULL) {
                        ts.tv_nsec -= 1000000000ULL;
                        ts.tv_sec++;
                }