We can't use O_TRUNC on open because (without O_EXLOCK which is not portable) we would be modifying the file without an exclusive lock. So, we drop the use of O_TRUNC and use ftruncate(2) after obtaining the lock via flock(2).
25 KiB
25 KiB