local_device_info_util_fuchsia.cc 542 B

1234567891011121314151617181920
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include <limits.h>
  5. #include <string.h>
  6. #include <unistd.h>
  7. #include <string>
  8. namespace syncer {
  9. std::string GetPersonalizableDeviceNameInternal() {
  10. char hostname[HOST_NAME_MAX];
  11. if (gethostname(hostname, std::size(hostname)) == 0) // Success.
  12. return std::string(hostname, strnlen(hostname, std::size(hostname)));
  13. return std::string();
  14. }
  15. } // namespace syncer