diff --git a/configure.in b/configure.in index c0a831b..9fc8241 100644 --- a/configure.in +++ b/configure.in @@ -465,7 +465,7 @@ AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension] AC_SEARCH_LIBS(socket,[socket network]) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) -AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull) +AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull gethostuuid) #### Check for broken poll; taken from Glib's configure diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index c3be1b7..b6aafc4 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -1079,7 +1079,9 @@ babysit (pid_t grandchild_pid, else if (pfds[1].revents & _DBUS_POLLIN) { char b; - read (sigchld_pipe[READ_END], &b, 1); + ssize_t chunk; + + chunk = read (sigchld_pipe[READ_END], &b, 1); /* do waitpid check */ check_babysit_events (grandchild_pid, parent_pipe, 0); } diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index e859ec6..6f295c3 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -3278,6 +3278,7 @@ _dbus_get_autolaunch_address (DBusString *address, * without rebooting I believe). If there's no standard one * we might want to use the registry instead of a file for * this, and I'm not sure how we'd ensure the uuid gets created. + * On OSX >= 10.6, uses function gethostuuid() to get hardware UUID. * * @param machine_id guid to init with the machine's uuid * @param create_if_not_found try to create the uuid if it doesn't exist @@ -3289,9 +3290,25 @@ _dbus_read_local_machine_uuid (DBusGUID *machine_id, dbus_bool_t create_if_not_found, DBusError *error) { +#ifndef HAVE_GETHOSTUUID DBusString filename; - _dbus_string_init_const (&filename, DBUS_MACHINE_UUID_FILE); + const char *uuidfile = _dbus_getenv ("DBUS_MACHINE_UUID_FILE"); + if (uuidfile == NULL) + uuidfile = DBUS_MACHINE_UUID_FILE; + _dbus_string_init_const (&filename, uuidfile); return _dbus_read_uuid_file (&filename, machine_id, create_if_not_found, error); +#else + uuid_t uuid; + struct timespec timeout = {0, 0}; + if (gethostuuid (uuid, &timeout) == -1) + { + dbus_set_error (error, DBUS_ERROR_FAILED, + "Failed to retrieve host UUID\n"); + return FALSE; + } + memcpy (machine_id->as_bytes, uuid, DBUS_UUID_LENGTH_BYTES); + return TRUE; +#endif } #define DBUS_UNIX_STANDARD_SESSION_SERVICEDIR "/dbus-1/services" diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index ec4c9a5..ecdf4e3 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -365,9 +365,11 @@ print_variables (const char *bus_address, pid_t bus_pid, long bus_wid, { if (binary_syntax) { - write (1, bus_address, strlen (bus_address) + 1); - write (1, &bus_pid, sizeof bus_pid); - write (1, &bus_wid, sizeof bus_wid); + int ret; + + ret = write (1, bus_address, strlen (bus_address) + 1); + ret = write (1, &bus_pid, sizeof bus_pid); + ret = write (1, &bus_wid, sizeof bus_wid); return; } else if (c_shell_syntax)