mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
curlx_now(), prevent zero timestamp
As code checks `curltime` values for zero and interprets this as not-initialized or "forever" in several places, make sure `curlx_now()` never returns a zero timestamp. Closes #21034
This commit is contained in:
parent
7e0a9b309c
commit
5649b21297
@ -166,6 +166,8 @@ void curlx_pnow(struct curltime *pnow)
|
||||
*/
|
||||
pnow->tv_sec = time(NULL);
|
||||
pnow->tv_usec = 0;
|
||||
if(!pnow->tv_sec) /* avoid a `now` fully zero */
|
||||
pnow->tv_usec = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user