summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2015-08-12 11:37:00 +0200
committerDavid Henningsson <david.henningsson@canonical.com>2015-12-07 10:18:48 +0100
commit96f4b4ffe341a4d7c4a84dd46a9c9f60d94928d2 (patch)
tree06fbe37873d9fe17ca3e226bb71b9a2b129d89c2
parent96b368b960a4416a3d0c8b10d8fc1ab6ed636e58 (diff)
downloadpulseaudio-96f4b4ffe341a4d7c4a84dd46a9c9f60d94928d2.tar.gz
core-util: improve comments in pa_machine_id()
-rw-r--r--src/pulsecore/core-util.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 3d36993b6..1eb534ab4 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -3061,14 +3061,19 @@ char *pa_machine_id(void) {
char *h;
/* The returned value is supposed be some kind of ascii identifier
- * that is unique and stable across reboots. */
-
- /* First we try ${sysconfdir}/etc/machine-id, with fallbacks to
- * ${localstatedir}/lib/dbus/machine-id, /etc/machine-id and
- * /var/lib/dbus/machine-id, which are the best option we
- * have, since they fit perfectly our needs and are not as volatile
- * as the hostname which might be set from dhcp. */
-
+ * that is unique and stable across reboots. First we try if the machine-id
+ * file is available. If it's available, that's great, since it provides an
+ * identifier that suits our needs perfectly. If it's not, we fall back to
+ * the hostname, which is not as good, since it can change over time. */
+
+ /* We search for the machine-id file from four locations. The first two are
+ * relative to the configured installation prefix, but if we're installed
+ * under /usr/local, for example, it's likely that the machine-id won't be
+ * found there, so we also try the hardcoded paths.
+ *
+ * PA_MACHINE_ID or PA_MACHINE_ID_FALLBACK might exist on a Windows system,
+ * but the last two hardcoded paths certainly don't, hence we don't try
+ * them on Windows. */
if ((f = pa_fopen_cloexec(PA_MACHINE_ID, "r")) ||
(f = pa_fopen_cloexec(PA_MACHINE_ID_FALLBACK, "r")) ||
#if !defined(OS_IS_WIN32)