Skip to content

Commit e1463ae

Browse files
dmehaladubloom
andauthored
Apply suggestions from code review
Co-authored-by: Louis Tricot <[email protected]>
1 parent d7086f7 commit e1463ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/datadog/platform_util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ Optional<ino_t> get_inode(std::string_view path) {
314314
// whether the binary is running in host or not. However, it does not work when
315315
// running in a Docker in Docker environment.
316316
bool is_running_in_host_namespace() {
317+
// linux procfs file that represents the cgroup namespace of the current process
317318
if (auto inode = get_inode("/proc/self/ns/cgroup")) {
318319
return *inode == HOST_CGROUP_NAMESPACE_INODE;
319320
}
@@ -339,7 +340,7 @@ Optional<Cgroup> get_cgroup_version() {
339340
Optional<std::string> find_docker_container_id_from_cgroup() {
340341
constexpr std::string_view cgroup_path = "/proc/self/cgroup";
341342

342-
auto cgroup_fd = std::ifstream(cgroup_path.data(), std::ios::in);
343+
auto cgroup_fd = std::ifstream("/proc/self/cgroup", std::ios::in);
343344
if (!cgroup_fd.is_open()) return nullopt;
344345

345346
return find_docker_container_id(cgroup_fd);

src/datadog/platform_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Optional<std::string> find_docker_container_id(std::istream& source);
9494

9595
/// Function to retrieve the container metadata.
9696
///
97-
/// @return A `ContainerMetadata` object containing metadata of the container in
97+
/// @return A `ContainerID` object containing id of the container in
9898
/// which the current process is running.
9999
Optional<ContainerID> get_id();
100100

0 commit comments

Comments
 (0)