hwdb: port to flink_tmpfile()
authorLennart Poettering <lennart@poettering.net>
Fri, 3 Mar 2023 10:30:13 +0000 (11:30 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 3 Mar 2023 12:44:12 +0000 (13:44 +0100)
commitacbab8697ed7402f7a7bd688531561e76f2e254b
tree3d40ccf9b464694280e8a886470f9c785d390d3c
parent23e208e742855d28bb3b02db2093e5a8ffc102f6
hwdb: port to flink_tmpfile()

And modernize heavily while doing so.

Fixes: #21787

(Strictly speaking, this leaves a race window open: the the system is
powered off in the short interval when we linked in the prepared hwdb
file into the dir under a temporary name and are about to rename it to
the final name, then the file might be left over after all. But this
minimizes the window so much that this shouldn't be an issue in
real-life. Key after all is that with this change we'll build up the
hwdb file under O_TMPFILE, and thus are robust to power loss during the
slow operation)
src/shared/hwdb-util.c