ftruncate and using temporary files
It is recommended to use mkstemp and friends, then write, fsync, close, then rename... in case of a crash or a power loss before data is safely synced to disk.
936199 16:22:19.328051 openat(AT_FDCWD, "/etc/sysconfig/network-scripts/ifcfg-eno1", O_WRONLY|O_CREAT|O_CLOEXEC, 0644) = 20 <0.000013>
936199 16:22:19.328089 ftruncate(20, 0) = 0 <0.000062>