Skip to content

Commit

Permalink
cleanup(libscap): do not assert on unsupported getpid_global
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <luca@guerra.sh>
  • Loading branch information
LucaGuerra authored and Andreagit97 committed Jan 17, 2024
1 parent 24bebf7 commit edb2926
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions userspace/libscap/scap_platform_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,19 @@ bool scap_is_thread_alive(struct scap_platform* platform, int64_t pid, int64_t t

int32_t scap_getpid_global(struct scap_platform* platform, int64_t* pid)
{
if (platform && platform->m_vtable->get_global_pid)
if (platform == NULL)
{
char lasterr[SCAP_LASTERR_SIZE];
return platform->m_vtable->get_global_pid(platform, pid, lasterr);
ASSERT(false);
return SCAP_FAILURE;
}

ASSERT(false);
return SCAP_FAILURE;
if (platform->m_vtable->get_global_pid == NULL)
{
return SCAP_NOT_SUPPORTED;
}

char lasterr[SCAP_LASTERR_SIZE];
return platform->m_vtable->get_global_pid(platform, pid, lasterr);
}

const scap_machine_info* scap_get_machine_info(struct scap_platform* platform)
Expand Down

0 comments on commit edb2926

Please sign in to comment.