!616 release分支解决nanosleep 接口的rmtp参数被错误清零问题

Merge pull request !616 from wanghao-free/OpenHarmony_1.0.1_release
This commit is contained in:
openharmony_ci 2021-09-09 08:34:13 +00:00 committed by Gitee
commit 2a0db42072
1 changed files with 6 additions and 1 deletions

View File

@ -355,13 +355,18 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
{
int ret;
struct timespec srqtp;
struct timespec srmtp = { 0 };
struct timespec srmtp;
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
errno = EFAULT;
return -EFAULT;
}
if (rmtp && LOS_ArchCopyFromUser(&srmtp, rmtp, sizeof(struct timespec))) {
errno = EFAULT;
return -EFAULT;
}
ret = nanosleep(&srqtp, rmtp ? &srmtp : NULL);
if (ret < 0) {
return -get_errno();