Fix p_secstodate overflow handling (bug 22463)

Paul Eggert eggert@cs.ucla.edu
Wed Nov 22 17:08:00 GMT 2017


On 11/22/2017 08:49 AM, Joseph Myers wrote:
> -	time = __gmtime_r(&clock, &timebuf);
> +	if (secs > 0x7fffffff
> +	    || (time = __gmtime_r (&clock, &timebuf)) == NULL) {

__gmtime_r cannot return NULL if secs <= 0x7fffffff. As the goal appears 
to be to leave the current code alone as much as possible, this could be 
changed to simply check secs first, and then leave the assignment to 
"time" alone.



More information about the Libc-alpha mailing list