libc vdso time functions: correctly convert errors into errnos

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2023-08-12 18:45:43 +03:00
parent 220427da0e
commit 41acfee690
2 changed files with 10 additions and 2 deletions

View File

@ -48,7 +48,11 @@ __clock_gettime(clockid_t clock_id, struct timespec *ts)
error = __vdso_clock_gettime(clock_id, ts);
else
error = ENOSYS;
if (error == ENOSYS)
if (error == ENOSYS) {
error = __sys_clock_gettime(clock_id, ts);
} else if (error != 0) {
errno = error;
error = -1;
}
return (error);
}

View File

@ -44,7 +44,11 @@ __gettimeofday(struct timeval *tv, struct timezone *tz)
int error;
error = __vdso_gettimeofday(tv, tz);
if (error == ENOSYS)
if (error == ENOSYS) {
error = __sys_gettimeofday(tv, tz);
} else if (error != 0) {
errno = error;
error = -1;
}
return (error);
}