sysprofd: ftruncate() when overwriting files

This is really only used for proc like files which are generally a single
page, but might as well start from zero.
This commit is contained in:
Christian Hergert
2021-02-24 13:03:24 -08:00
parent 86fb061899
commit 4777e74862

View File

@ -78,6 +78,8 @@ file_set_contents_no_backup (const gchar *path,
return FALSE;
}
ftruncate (fd, 0);
if (write (fd, contents, len) != len)
{
int errsv = errno;