Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set errno in adjtime (IDFGH-8915) #10334

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

jofrev
Copy link
Contributor

@jofrev jofrev commented Dec 8, 2022

In contrast to other time function implementations (e.g. settimeofday) and its man page, adjtime does not set errno in case it fails.

There are two possible scenarios for adjtime to fail at the moment:

  1. the provided adjustment delta is too large -> errno should be set to EINVAL according to the man page
  2. newlib time function implementations are disabled -> other functions (e.g. settimeofday) return ENOSYS in this case

This pull request fixes both.

Maybe this is something that should also be fixed in some of the older stable releases which are still in maintenance period. What do you think? I would love to see it fixed for v4.4 at least, which is the version I discovered this on 😉

Other time functions (e.g. settimeofday) set errno to ENOSYS if
IMPL_NEWLIB_TIME_FUNCS is not set.
adjtime should probably do the same.
errno should be set to EINVAL in this case according to adjtime's man
page.
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 8, 2022
@github-actions github-actions bot changed the title Set errno in adjtime Set errno in adjtime (IDFGH-8915) Dec 8, 2022
@Alvin1Zhang
Copy link
Collaborator

Thanks for your contribution.

@suda-morris
Copy link
Collaborator

sha=60767c234daaea9dfa8b4fa8f721f565b163c3e0

@suda-morris suda-morris added the PR-Sync-Merge Pull request sync as merge commit label Dec 9, 2022
@jofrev jofrev changed the title Set errno in adjtime (IDFGH-8915) Set errno in adjtime (IDFGH-8915) Dec 9, 2022
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Resolution: NA Issue resolution is unavailable labels Dec 13, 2022
@espressif-bot espressif-bot merged commit ff23012 into espressif:master Dec 14, 2022
@jofrev jofrev deleted the set-errno-in-adjtime branch December 14, 2022 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Sync-Merge Pull request sync as merge commit Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants