Make dbus-uuidgen atomic
authorColin Walters <walters@verbum.org>
Fri, 3 Sep 2010 14:18:25 +0000 (10:18 -0400)
committerColin Walters <walters@verbum.org>
Fri, 3 Sep 2010 18:29:53 +0000 (14:29 -0400)
commit45d53565bc13678d6aa5edec1d4efb5bf8a64e0b
tree2d7793d95690894d29d52f7ece35ec8600d39727
parentff2325c92c411e6718ae38d6976f54580ed57e86
Make dbus-uuidgen atomic

A Red Hat QA engineer hit in practice a race condition in dbus-uuidgen
where it could leave an empty file.

dbus-uuidgen (_dbus_create_uuid_file_exclusively) formerly created an
empty file in the path to the uuid, then filled it in.  At some point,
the internal libdbus _dbus_string_save_to_file became atomic on Unix
at least (doing the save to temp file, fsync(), rename() dance).

So _dbus_create_uuid_file_exclusively doesn't need to create the file
beforehand anymore.  However, it *does* need the file to be
world-readable, unlike all other consumers of
_dbus_string_save_to_file.  So add a "world_readable" argument.
dbus/dbus-file-unix.c
dbus/dbus-file-win.c
dbus/dbus-file.h
dbus/dbus-internals.c
dbus/dbus-keyring.c
dbus/dbus-nonce.c
test/break-loader.c