fuchsia: Use zx_system_get_version_string

The new API replaces zx_system_get_version and is simpler.

Bug: fuchsia:45640
Change-Id: Ibc47703aba0e87e55265608b517e5953eada182f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2063908
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Roland McGrath 2020-02-18 18:18:23 -08:00 committed by Commit Bot
parent 9ed8290547
commit 22701bb0e4

View File

@ -38,10 +38,7 @@ void SystemSnapshotFuchsia::Initialize(const timeval* snapshot_time) {
// garnet/bin/uname/uname.c, however, this information isn't provided by
// uname(). Additionally, uname() seems to hang if the network is in a bad
// state when attempting to retrieve the nodename, so avoid it for now.
char kernel_version[256] = {};
zx_status_t status =
zx_system_get_version(kernel_version, sizeof(kernel_version));
ZX_LOG_IF(ERROR, status != ZX_OK, status) << "zx_system_get_version";
std::string kernel_version = zx_system_get_version_string();
#if defined(ARCH_CPU_X86_64)
static constexpr const char kArch[] = "x86_64";
@ -50,8 +47,8 @@ void SystemSnapshotFuchsia::Initialize(const timeval* snapshot_time) {
#else
static constexpr const char kArch[] = "unknown";
#endif
os_version_full_ =
base::StringPrintf("Zircon prerelease %s %s", kernel_version, kArch);
os_version_full_ = base::StringPrintf(
"Zircon prerelease %s %s", kernel_version.c_str(), kArch);
INITIALIZATION_STATE_SET_VALID(initialized_);
}