]> git.ipfire.org Git - thirdparty/systemd.git/commit
tmpfiles: introduce truncate_file() which deals with 'F' exclusively
authorFranck Bui <fbui@suse.com>
Fri, 13 Apr 2018 15:31:22 +0000 (17:31 +0200)
committerFranck Bui <fbui@suse.com>
Mon, 30 Jul 2018 13:53:53 +0000 (15:53 +0200)
commit5ec9d065128cfc6ffde28abd3938f5009e36e41a
tree7badac28cb87ab93fd62e9b440964e1dc0f4a427
parent31c84ff11ea22b0bc1b2459db09e4d2aa66bdf2a
tmpfiles: introduce truncate_file() which deals with 'F' exclusively

TRUNCATE_FILE is now handled by a new dedicated function
truncate_file(). Indeed we have to take special care when truncating existing
file since the behavior is only specified for regular files.

Well that's not entirely true for fifo and terminal devices since O_TRUNC is
ignored in this case but even in for these types of file, truncating is
probably not the right thing to do.

It is worth noting that both truncate_file() and create_file() have been
modified so they use fstat(2) instead of stat(2) since both functions are not
supposed to follow symlinks.
src/tmpfiles/tmpfiles.c