YottaDB / YDB

Mirrored from https://gitlab.com/YottaDB/DB/YDB
Other
76 stars 37 forks source link

[#318] Fix incorrect time check in prior commit of sr_port/restrict.c #327

Closed nars1 closed 6 years ago

nars1 commented 6 years ago

The check for whether one file is newer than the other was done as follows in a prior commit.

(rmtime.tv_sec > fmtime.tv_sec) || (rmtime.tv_nsec >= fmtime.tv_nsec)

But this will result in a false evaluation in the case rmtime.tv_sec < fmtime.tv_sec but rmtime.tv_nsec > fmtime.tv_nsec. That is what happened in an in-house test on the Raspberry Pi boxes which caused the filter_commands.tab file to be recreated in the middle of adding lines from a multi-line restrict.txt file.

The check is now corrected to read as follows

(rmtime.tv_sec > fmtime.tv_sec) || (rmtime.tv_sec == fmtime.tv_sec) && (rmtime.tv_nsec >= fmtime.tv_nsec)

With this check, the test reliably passes on the Pi boxes.