Garrett: ext4, application expectations and power management
Garrett: ext4, application expectations and power management
Posted Mar 16, 2009 5:24 UTC (Mon) by bojan (subscriber, #14302)In reply to: Garrett: ext4, application expectations and power management by flewellyn
Parent article: Garrett: ext4, application expectations and power management
> there is no good reason to use O_TRUNC
O_TRUNC is used on the new file:
3.b) fd = open("~/.kde/foo/bar/baz.new", O_WRONLY|O_TRUNC|O_CREAT)
That's because the file by the same name (i.e. baz.new) may exist and contain random garbage, which is then removed by O_TRUNC.
> And don't recreate a file that isn't changing, for heaven's sakes!
Yeah, that's one of the key things. Don't touch what didn't change.
