Skip to content

Commit

Permalink
chore(userspace/libsinsp): better check leveraging `query_os_for_miss…
Browse files Browse the repository at this point in the history
…ing_info`.

Signed-off-by: Federico Di Pierro <[email protected]>

Co-authored-by: Angelo Puglisi <[email protected]>
  • Loading branch information
FedeDP and deepskyblue86 committed May 8, 2024
1 parent 721fa55 commit ef446da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions userspace/libsinsp/container_engine/docker/podman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,8 @@ int detect_podman(const sinsp_threadinfo *tinfo, std::string &container_id)
}
}

bool podman::can_api_sock_exist(sinsp *inspector)
bool podman::can_api_sock_exist()
{
// Short-circuit: always enable podman when running from a capture file.
if (inspector->is_capture())
{
return true;
}

glob_t gl;
int rc;
int glob_flags = 0;
Expand Down Expand Up @@ -199,7 +193,14 @@ bool podman::resolve(sinsp_threadinfo *tinfo, bool query_os_for_missing_info)

if(!m_api_sock_can_exist.has_value())
{
m_api_sock_can_exist = can_api_sock_exist(tinfo->m_inspector);
if (query_os_for_missing_info)
{
m_api_sock_can_exist = can_api_sock_exist();
}
else
{
m_api_sock_can_exist = true;
}
}

if(!m_api_sock_can_exist.value())
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/container_engine/docker/podman.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class podman : public docker_base
std::optional<bool> m_api_sock_can_exist;

// Return true if any possible api socket pattern exists.
static bool can_api_sock_exist(sinsp *inspector);
static bool can_api_sock_exist();

// Return whether or not any possible api socket exists. (The actual socket is
// implement container_engine_base
Expand Down

0 comments on commit ef446da

Please sign in to comment.