Skip to content

OSAL not reporting correct error string if clock_getres() call in OS_Posix_TimeBaseAPI_Impl_Init fails #686

@ericgilligan-nasa

Description

@ericgilligan-nasa

OS_DEBUG("failed in clock_getres: %s\n", strerror(status));

From clock_getres man pages:

clock_gettime(), clock_settime() and clock_getres() return 0 for success, or -1 for failure (in which case errno is set appropriately).

The return value of clock_getres() is just 0 or -1. If it returns -1 in the event of a failure, it sets errno, so the OS_DEBUG line should use strerror(errno), not strerror(status), otherwise it always reports:

OS_Posix_TimeBaseAPI_Impl_Init():222:failed in clock_getres: Unknown error -1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions