local_device_info_util_linux.cc 556 B

12345678910111213141516171819202122
  1. // Copyright (c) 2013 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> // for HOST_NAME_MAX
  5. #include <unistd.h> // for gethostname()
  6. #include <string>
  7. #include "base/linux_util.h"
  8. namespace syncer {
  9. std::string GetPersonalizableDeviceNameInternal() {
  10. char hostname[HOST_NAME_MAX];
  11. if (gethostname(hostname, HOST_NAME_MAX) == 0) { // Success.
  12. return hostname;
  13. }
  14. return base::GetLinuxDistro();
  15. }
  16. } // namespace syncer