Re: [PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-15 Thread walter harms
some nitpicking ...
man 3 difftime

i pretty sure it will cause a fundamental change ...


just my 2 cents
re,
 wh

Am 15.10.2015 00:13, schrieb Jeremy Huddleston Sequoia:
> xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of 
> type 'long' but has parameter of
> type
> 'int'
>   which may cause truncation of value [-Wabsolute-value,Semantic Issue]
> if (abs(now - client->time) > TwentyFiveMinutes) {
> ^
> xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
> if (abs(now - client->time) > TwentyFiveMinutes) {
> ^~~
> labs
> xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
> type 'long' but has parameter of type
> 'int' which
>   may cause truncation of value [-Wabsolute-value,Semantic Issue]
> if (abs(client->time - now) > TwentyMinutes) {
> ^
> xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
> if (abs(client->time - now) > TwentyMinutes) {
> ^~~
> labs
> 
> Signed-off-by: Jeremy Huddleston Sequoia 
> ---
>  os/xdmauth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/os/xdmauth.c b/os/xdmauth.c
> index f11cbb9..482bc67 100644
> --- a/os/xdmauth.c
> +++ b/os/xdmauth.c
> @@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
>  prev = 0;
>  for (client = xdmClients; client; client = next) {
>  next = client->next;
> -if (abs(now - client->time) > TwentyFiveMinutes) {
> +if (labs(now - client->time) > TwentyFiveMinutes) {
>  if (prev)
>  prev->next = next;
>  else
> @@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
>  }
>  now += clockOffset;
>  XdmClientAuthTimeout(now);
> -if (abs(client->time - now) > TwentyMinutes) {
> +if (labs(client->time - now) > TwentyMinutes) {
>  free(client);
>  if (reason)
>  *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-15 Thread Jeremy Huddleston Sequoia
Can you elaborate on your concern?

Are you suggesting using difftime() instead of fabs()?  I agree that would 
probably be a good idea, but I don't see why this change would look scary to 
you.

--Jeremy

> On Oct 15, 2015, at 06:47, walter harms  wrote:
> 
> some nitpicking ...
> man 3 difftime
> 
> i pretty sure it will cause a fundamental change ...
> 
> 
> just my 2 cents
> re,
> wh
> 
> Am 15.10.2015 00:13, schrieb Jeremy Huddleston Sequoia:
>> xdmauth.c:230:13: warning: absolute value function 'abs' given an argument 
>> of type 'long' but has parameter of
>> type
>> 'int'
>>  which may cause truncation of value [-Wabsolute-value,Semantic Issue]
>>if (abs(now - client->time) > TwentyFiveMinutes) {
>>^
>> xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
>>if (abs(now - client->time) > TwentyFiveMinutes) {
>>^~~
>>labs
>> xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
>> type 'long' but has parameter of type
>> 'int' which
>>  may cause truncation of value [-Wabsolute-value,Semantic Issue]
>>if (abs(client->time - now) > TwentyMinutes) {
>>^
>> xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
>>if (abs(client->time - now) > TwentyMinutes) {
>>^~~
>>labs
>> 
>> Signed-off-by: Jeremy Huddleston Sequoia 
>> ---
>> os/xdmauth.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/os/xdmauth.c b/os/xdmauth.c
>> index f11cbb9..482bc67 100644
>> --- a/os/xdmauth.c
>> +++ b/os/xdmauth.c
>> @@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
>> prev = 0;
>> for (client = xdmClients; client; client = next) {
>> next = client->next;
>> -if (abs(now - client->time) > TwentyFiveMinutes) {
>> +if (labs(now - client->time) > TwentyFiveMinutes) {
>> if (prev)
>> prev->next = next;
>> else
>> @@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int 
>> length,
>> }
>> now += clockOffset;
>> XdmClientAuthTimeout(now);
>> -if (abs(client->time - now) > TwentyMinutes) {
>> +if (labs(client->time - now) > TwentyMinutes) {
>> free(client);
>> if (reason)
>> *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-14 Thread Jeremy Huddleston Sequoia
xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of
type
'int'
  which may cause truncation of value [-Wabsolute-value,Semantic Issue]
if (abs(now - client->time) > TwentyFiveMinutes) {
^
xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
if (abs(now - client->time) > TwentyFiveMinutes) {
^~~
labs
xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of type
'int' which
  may cause truncation of value [-Wabsolute-value,Semantic Issue]
if (abs(client->time - now) > TwentyMinutes) {
^
xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
if (abs(client->time - now) > TwentyMinutes) {
^~~
labs

Signed-off-by: Jeremy Huddleston Sequoia 
---
 os/xdmauth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/xdmauth.c b/os/xdmauth.c
index f11cbb9..482bc67 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
 prev = 0;
 for (client = xdmClients; client; client = next) {
 next = client->next;
-if (abs(now - client->time) > TwentyFiveMinutes) {
+if (labs(now - client->time) > TwentyFiveMinutes) {
 if (prev)
 prev->next = next;
 else
@@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
 }
 now += clockOffset;
 XdmClientAuthTimeout(now);
-if (abs(client->time - now) > TwentyMinutes) {
+if (labs(client->time - now) > TwentyMinutes) {
 free(client);
 if (reason)
 *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
-- 
2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xquartz 03/10] xdmauth: Correct miscall of abs() to instrad call labs()

2015-10-14 Thread Alan Coopersmith

On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:

xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of
type
'int'
   which may cause truncation of value [-Wabsolute-value,Semantic Issue]
 if (abs(now - client->time) > TwentyFiveMinutes) {
 ^
xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
 if (abs(now - client->time) > TwentyFiveMinutes) {
 ^~~
 labs
xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of 
type 'long' but has parameter of type
'int' which
   may cause truncation of value [-Wabsolute-value,Semantic Issue]
 if (abs(client->time - now) > TwentyMinutes) {
 ^
xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
 if (abs(client->time - now) > TwentyMinutes) {
 ^~~
 labs

Signed-off-by: Jeremy Huddleston Sequoia 
---
  os/xdmauth.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/xdmauth.c b/os/xdmauth.c
index f11cbb9..482bc67 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
  prev = 0;
  for (client = xdmClients; client; client = next) {
  next = client->next;
-if (abs(now - client->time) > TwentyFiveMinutes) {
+if (labs(now - client->time) > TwentyFiveMinutes) {
  if (prev)
  prev->next = next;
  else
@@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
  }
  now += clockOffset;
  XdmClientAuthTimeout(now);
-if (abs(client->time - now) > TwentyMinutes) {
+if (labs(client->time - now) > TwentyMinutes) {
  free(client);
  if (reason)
  *reason = "Excessive XDM-AUTHORIZATION-1 time offset";



Reviewed-by: Alan Coopersmith 

--
-Alan Coopersmith-  alan.coopersm...@oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel