SWDEV-387026: using gethostid instead of depending on libsystemd
Change-Id: If576eec4abee1a52dfe7cc5bce507420bc8a4d07
Tento commit je obsažen v:
@@ -27,7 +27,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <systemd/sd-id128.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
@@ -50,14 +49,7 @@ namespace {
|
||||
}
|
||||
|
||||
[[maybe_unused]] uint64_t GetMachineID() {
|
||||
char hostname[1023] = "\0";
|
||||
gethostname(hostname, 1023);
|
||||
sd_id128_t ret;
|
||||
char machine_id[SD_ID128_STRING_MAX];
|
||||
[[maybe_unused]] int status = sd_id128_get_machine(&ret);
|
||||
assert(status == 0 && "Error: Couldn't get machine id!");
|
||||
if (sd_id128_to_string(ret, machine_id)) return std::hash<std::string>{}(machine_id);
|
||||
return std::rand();
|
||||
return gethostid();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele