summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-unix.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-06-07 14:47:12 +0100
committerSimon McVittie <smcv@collabora.com>2017-06-08 17:00:35 +0100
commitbde40c8970d7e1314edc9f84d5bf55c7fc6d8e57 (patch)
treeb16d96bffa68d8bd4bf96ae72b7a9d4213468de9 /dbus/dbus-sysdeps-unix.c
parente327478e756368dda26846a10f59ddd34a38232d (diff)
Unix sysdeps: Only copy /etc/machine-id to ${sysconfdir} in "ensure" mode
System integration scripts use dbus-uuidgen --ensure, so they are unaffected by this, and in particular the solution to Bug #77941 is still valid. The shared library is typically loaded by unprivileged users, so trying to write out the machine-id file is not going to work anyway. However, if we *can* write to our ${sysconfdir} - notably during `make distcheck` - then it is unexpected that merely reading the machine ID has the side-effect of writing to ${sysconfdir}, and in particular it will make the check for a complete uninstall fail. We definitely must not delete the machine ID during `make uninstall`. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101257
Diffstat (limited to 'dbus/dbus-sysdeps-unix.c')
-rw-r--r--dbus/dbus-sysdeps-unix.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 8b6ac306..7bfb66fe 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -3922,10 +3922,13 @@ _dbus_read_local_machine_uuid (DBusGUID *machine_id,
if (b)
{
- /* try to copy it to the DBUS_MACHINE_UUID_FILE, but do not
- * complain if that isn't possible for whatever reason */
- _dbus_string_init_const (&filename, DBUS_MACHINE_UUID_FILE);
- _dbus_write_uuid_file (&filename, machine_id, NULL);
+ if (create_if_not_found)
+ {
+ /* try to copy it to the DBUS_MACHINE_UUID_FILE, but do not
+ * complain if that isn't possible for whatever reason */
+ _dbus_string_init_const (&filename, DBUS_MACHINE_UUID_FILE);
+ _dbus_write_uuid_file (&filename, machine_id, NULL);
+ }
return TRUE;
}