core: Look up /etc/machine-id if D-Bus machine-id is not found

It appears that this is currently the fallback for early boot and other
such cases where /var might not be available. Relevant upstream commit:

http://cgit.freedesktop.org/dbus/dbus/commit/?id=66e52541d5bdd4927a5c702963749760643313f4

Thanks to Samuli Suominen <ssuominen@gentoo.org> for pointing this out
in https://bugs.gentoo.org/show_bug.cgi?id=390287
This commit is contained in:
Arun Raghavan 2011-11-14 13:42:21 +05:30
parent c2976b1f87
commit 42881d2770
2 changed files with 5 additions and 1 deletions

View file

@ -2717,7 +2717,8 @@ char *pa_machine_id(void) {
* since it fits perfectly our needs and is not as volatile as the
* hostname which might be set from dhcp. */
if ((f = pa_fopen_cloexec(PA_MACHINE_ID, "r"))) {
if ((f = pa_fopen_cloexec(PA_MACHINE_ID, "r")) ||
(f = pa_fopen_cloexec(PA_MACHINE_ID_FALLBACK, "r"))) {
char ln[34] = "", *r;
r = fgets(ln, sizeof(ln)-1, f);