diff --git a/syscall/time_syscall.c b/syscall/time_syscall.c index 10ef483cc26146d98a732a3670befd1fa8fb4b2c..038b827c660b5f0448131c2fb565c1d462b00a56 100755 --- a/syscall/time_syscall.c +++ b/syscall/time_syscall.c @@ -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();