Skip to content

Commit 4b56ac1

Browse files
committed
Fix nasa#569, Check and report sysconf error return
1 parent fa0cffa commit 4b56ac1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/os/posix/src/os-impl-tasks.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ static bool OS_Posix_GetSchedulerParams(int sched_policy, POSIX_PriorityLimits_t
206206
int32 OS_Posix_TaskAPI_Impl_Init(void)
207207
{
208208
int ret;
209+
long ret_long;
209210
int sig;
210211
struct sched_param sched_param;
211212
int sched_policy;
@@ -417,7 +418,13 @@ int32 OS_Posix_TaskAPI_Impl_Init(void)
417418
}
418419
#endif
419420

420-
POSIX_GlobalVars.PageSize = sysconf(_SC_PAGESIZE);
421+
ret_long = sysconf(_SC_PAGESIZE);
422+
if (ret_long < 0)
423+
{
424+
OS_DEBUG("Could not get page size via sysconf: %s\n", strerror(errno));
425+
return OS_ERROR;
426+
}
427+
POSIX_GlobalVars.PageSize = ret_long;
421428

422429
return OS_SUCCESS;
423430
} /* end OS_Posix_TaskAPI_Impl_Init */

0 commit comments

Comments
 (0)