cloud_policy_util: IWYU: HOST_NAME_MAX needs limits.h.
Stop relying on the header being included implicitly. This fixes the build with libstdc++ after b1303e03 ("Add support in CloudPolicyClient for machine enrollment and reporting"): ../../components/policy/core/common/cloud/cloud_policy_util.cc: In function ‘std::__cxx11::string policy::GetMachineName()’: ../../components/policy/core/common/cloud/cloud_policy_util.cc:33:17: error: ‘HOST_NAME_MAX’ was not declared in this scope char hostname[HOST_NAME_MAX]; ^~~~~~~~~~~~~ ../../components/policy/core/common/cloud/cloud_policy_util.cc:33:17: note: suggested alternative: ‘_SC_HOST_NAME_MAX’ char hostname[HOST_NAME_MAX]; ^~~~~~~~~~~~~ _SC_HOST_NAME_MAX ../../components/policy/core/common/cloud/cloud_policy_util.cc:34:19: error: ‘hostname’ was not declared in this scope if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success. ^~~~~~~~ ../../components/policy/core/common/cloud/cloud_policy_util.cc:34:19: note: suggested alternative: ‘basename’ if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success. ^~~~~~~~ basename While HOST_NAME_MAX is only used in the Linux code path, it should be harmless to include the header unconditionally. BUG=812641 Change-Id: I6769792efe188ff437753e4cb1ba134c341c20e9 Reviewed-on: https://chromium-review.googlesource.com/987895Reviewed-by:Maksim Ivanov <emaxx@chromium.org> Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Cr-Commit-Position: refs/heads/master@{#548370}
Showing
Please register or sign in to comment