Skip to content

Commit

Permalink
ksh: sleep inf: simplify (re: dd1dc47)
Browse files Browse the repository at this point in the history
This can be done much more simply using a pause(3) call.
  • Loading branch information
McDutchie committed Nov 17, 2024
1 parent dd1dc47 commit b74eb11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/cmd/ksh93/bltins/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ void sh_delay(double t, int sflag)
#if _lib_isinf
if (isinf(t))
{
ts.tv_sec = 0xFFFFFFFF; /* uint32_t max */
ts.tv_nsec = 0;
while (1)
if (tvsleep(&ts, NULL) < 0 && ((sh.trapnote & (SH_SIGSET | SH_SIGTRAP)) || sflag))
{
pause();
if ((sh.trapnote & (SH_SIGSET | SH_SIGTRAP)) || sflag)
return;
}
}
#endif /* _lib_isinf */
n = (uint32_t)t;
Expand Down

0 comments on commit b74eb11

Please sign in to comment.