openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/dbus/1.12.16-r0/dbus-1.12.16/dbus/dbus-sysdeps-unix.c
dbus_bool_t _dbus_read_local_machine_uuid(DBusGUID* machine_id,
                                          dbus_bool_t create_if_not_found,
                                          DBusError* error)
{
    DBusError our_error = DBUS_ERROR_INIT;
    DBusError etc_error = DBUS_ERROR_INIT;
    DBusString filename;
    dbus_bool_t b;

    _dbus_string_init_const(&filename, DBUS_MACHINE_UUID_FILE);

    b = _dbus_read_uuid_file(&filename, machine_id, FALSE, &our_error);
    if (b)
        return TRUE;

    /* Fallback to the system machine ID */
    _dbus_string_init_const(&filename, "/etc/machine-id");
    b = _dbus_read_uuid_file(&filename, machine_id, FALSE, &etc_error);

    if (b)
    {
        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);
        }

        dbus_error_free(&our_error);
        return TRUE;
    }

    if (!create_if_not_found)
    {
        dbus_set_error(error, etc_error.name,
                       "D-Bus library appears to be incorrectly set up: "
                       "see the manual page for dbus-uuidgen to correct "
                       "this issue. (%s; %s)",
                       our_error.message, etc_error.message);
        dbus_error_free(&our_error);
        dbus_error_free(&etc_error);
        return FALSE;
    }

    dbus_error_free(&our_error);
    dbus_error_free(&etc_error);

    /* if none found, try to make a new one */
    _dbus_string_init_const(&filename, DBUS_MACHINE_UUID_FILE);

    if (!_dbus_generate_uuid(machine_id, error))
        return FALSE;

    return _dbus_write_uuid_file(&filename, machine_id, error);
}
/**
 * Reads the uuid of the machine we're running on from
 * the dbus configuration. Optionally try to create it
 * (only root can do this usually).
 *
 * On UNIX, reads a file that gets created by dbus-uuidgen
 * in a post-install script. On Windows, if there's a standard
 * machine uuid we could just use that, but I can't find one
 * with the right properties (the hardware profile guid can change
 * 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.
 *
 * @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
 * @param error the error return
 * @returns #FALSE if the error is set
 */
Reads the uuid of the machine we're running on from
the dbus configuration. Optionally try to create it
(only root can do this usually).

On UNIX, reads a file that gets created by dbus-uuidgen
in a post-install script. On Windows, if there's a standard
machine uuid we could just use that, but I can't find one
with the right properties (the hardware profile guid can change
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.

@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
@param error the error return
@returns #FALSE if the error is set
Reads the uuid of the machine we ' re running on from the dbus configuration . Optionally try to create it ( only root can do this usually ) . On UNIX reads a file that gets created by dbus - uuidgen in a post - install script . On Windows if there ' s a standard machine uuid we could just use that but I can ' t find one with the right properties ( the hardware profile guid can change 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 . @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 @param error the error return @returns #FALSE if the error is set
dbus_bool_t _dbus_read_local_machine_uuid(DBusGUID* machine_id,
                                          dbus_bool_t create_if_not_found,
                                          DBusError* error)
{
    DBusError our_error = DBUS_ERROR_INIT;
    DBusError etc_error = DBUS_ERROR_INIT;
    DBusString filename;
    dbus_bool_t b;
    _dbus_string_init_const(&filename, DBUS_MACHINE_UUID_FILE);
    b = _dbus_read_uuid_file(&filename, machine_id, FALSE, &our_error);
    if (b)
        return TRUE;
    _dbus_string_init_const(&filename, "/etc/machine-id");
    b = _dbus_read_uuid_file(&filename, machine_id, FALSE, &etc_error);
    if (b)
    {
        if (create_if_not_found)
        {
            _dbus_string_init_const(&filename, DBUS_MACHINE_UUID_FILE);
            _dbus_write_uuid_file(&filename, machine_id, NULL);
        }
        dbus_error_free(&our_error);
        return TRUE;
    }
    if (!create_if_not_found)
    {
        dbus_set_error(error, etc_error.name,
                       "D-Bus library appears to be incorrectly set up: "
                       "see the manual page for dbus-uuidgen to correct "
                       "this issue. (%s; %s)",
                       our_error.message, etc_error.message);
        dbus_error_free(&our_error);
        dbus_error_free(&etc_error);
        return FALSE;
    }
    dbus_error_free(&our_error);
    dbus_error_free(&etc_error);
    _dbus_string_init_const(&filename, DBUS_MACHINE_UUID_FILE);
    if (!_dbus_generate_uuid(machine_id, error))
        return FALSE;
    return _dbus_write_uuid_file(&filename, machine_id, error);
}
dbus_bool_t _dbus_read_local_machine_uuid ( DBusGUID * machine_id , dbus_bool_t create_if_not_found , DBusError * error ) { DBusError our_error = DBUS_ERROR_INIT ; DBusError etc_error = DBUS_ERROR_INIT ; DBusString filename ; dbus_bool_t b ; _dbus_string_init_const ( & filename , DBUS_MACHINE_UUID_FILE ) ; b = _dbus_read_uuid_file ( & filename , machine_id , FALSE , & our_error ) ; if ( b ) return TRUE ; _dbus_string_init_const ( & filename , " " ) ; b = _dbus_read_uuid_file ( & filename , machine_id , FALSE , & etc_error ) ; if ( b ) { if ( create_if_not_found ) { _dbus_string_init_const ( & filename , DBUS_MACHINE_UUID_FILE ) ; _dbus_write_uuid_file ( & filename , machine_id , NULL ) ; } dbus_error_free ( & our_error ) ; return TRUE ; } if ( ! create_if_not_found ) { dbus_set_error ( error , etc_error . name , " " " " " " , our_error . message , etc_error . message ) ; dbus_error_free ( & our_error ) ; dbus_error_free ( & etc_error ) ; return FALSE ; } dbus_error_free ( & our_error ) ; dbus_error_free ( & etc_error ) ; _dbus_string_init_const ( & filename , DBUS_MACHINE_UUID_FILE ) ; if ( ! _dbus_generate_uuid ( machine_id , error ) ) return FALSE ; return _dbus_write_uuid_file ( & filename , machine_id , error ) ; }
Reads the uuid of the machine we're running on from
 the dbus configuration.
Reads the uuid of the machine we ' re running on from the dbus configuration .
/* Fallback to the system machine ID */ /* try to copy it to the DBUS_MACHINE_UUID_FILE, but do not
             * complain if that isn't possible for whatever reason */ /* if none found, try to make a new one */