Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Nov 2014 16:33:55 +0300
From:      Andrey Chernov <ache@freebsd.org>
To:        Garrett Cooper <ngie@FreeBSD.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r274365 - head/contrib/tzcode/stdtime
Message-ID:  <54621043.9000502@freebsd.org>
In-Reply-To: <201411110407.sAB47gBT003976@svn.freebsd.org>
References:  <201411110407.sAB47gBT003976@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11.11.2014 7:07, Garrett Cooper wrote:
> Author: ngie
> Date: Tue Nov 11 04:07:41 2014
> New Revision: 274365
> URL: https://svnweb.freebsd.org/changeset/base/274365
> 
> Log:
>   Revert WiP to contrib/tzcode accidentally committed with r274364

This code is wrong in any case, setting EOVERFLOW even in unneeded
no-error cases like breaking from the loop. See how NetBSD does it
correctly instead.

> 
> Modified:
>   head/contrib/tzcode/stdtime/localtime.c
> 
> Modified: head/contrib/tzcode/stdtime/localtime.c
> ==============================================================================
> --- head/contrib/tzcode/stdtime/localtime.c	Tue Nov 11 04:06:05 2014	(r274364)
> +++ head/contrib/tzcode/stdtime/localtime.c	Tue Nov 11 04:07:41 2014	(r274365)
> @@ -1792,11 +1792,7 @@ int	delta;
>  
>  	number0 = *number;
>  	*number += delta;
> -	if ((*number < number0) != (delta < 0)) {
> -		errno = EOVERFLOW;
> -		return (1);
> -	}
> -	return (0);
> +	return (*number < number0) != (delta < 0);
>  }
>  
>  static int
> @@ -1808,11 +1804,7 @@ int	delta;
>  
>  	number0 = *number;
>  	*number += delta;
> -	if ((*number < number0) != (delta < 0)) {
> -		errno = EOVERFLOW;
> -		return (1);
> -	}
> -	return (0);
> +	return (*number < number0) != (delta < 0);
>  }
>  
>  static int
> 


-- 
http://ache.vniz.net/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54621043.9000502>