Skip to content

Commit

Permalink
Merge pull request #682 from skliper/fix569-neg_sysconf
Browse files Browse the repository at this point in the history
Fix #569, Check and report sysconf error return
  • Loading branch information
astrogeco authored Dec 18, 2020
2 parents 26360b7 + 4b56ac1 commit 7586872
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/os/posix/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static bool OS_Posix_GetSchedulerParams(int sched_policy, POSIX_PriorityLimits_t
int32 OS_Posix_TaskAPI_Impl_Init(void)
{
int ret;
long ret_long;
int sig;
struct sched_param sched_param;
int sched_policy;
Expand Down Expand Up @@ -417,7 +418,13 @@ int32 OS_Posix_TaskAPI_Impl_Init(void)
}
#endif

POSIX_GlobalVars.PageSize = sysconf(_SC_PAGESIZE);
ret_long = sysconf(_SC_PAGESIZE);
if (ret_long < 0)
{
OS_DEBUG("Could not get page size via sysconf: %s\n", strerror(errno));
return OS_ERROR;
}
POSIX_GlobalVars.PageSize = ret_long;

return OS_SUCCESS;
} /* end OS_Posix_TaskAPI_Impl_Init */
Expand Down

0 comments on commit 7586872

Please sign in to comment.