Skip to content

Commit 3645241

Browse files
committed
glibc2.31-stime: Fix build on glibc>=2.31 by replacing stime() with clock_settime().
The obsolete function stime is no longer available to newly linked binaries, and its declaration has been removed from <time.h>. Programs that set the system time should use clock_settime instead. https://lwn.net/Articles/811275/ https://linux.die.net/man/3/clock_settime
1 parent 23b58bb commit 3645241

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

linux-user/syscall.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8861,10 +8861,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
88618861
#ifdef TARGET_NR_stime /* not on alpha */
88628862
case TARGET_NR_stime:
88638863
{
8864-
time_t host_time;
8865-
if (get_user_sal(host_time, arg1))
8864+
struct timespec ts;
8865+
ts.tv_nsec = 0;
8866+
if (get_user_sal(ts.tv_sec, arg1))
88668867
goto efault;
8867-
ret = get_errno(stime(&host_time));
8868+
ret = get_errno(clock_settime(CLOCK_REALTIME, &ts));
88688869
}
88698870
break;
88708871
#endif

0 commit comments

Comments
 (0)