pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/55284: 'wmweather' broken on architecture where sizeof(long) < sizeof(time_t)



The following reply was made to PR pkg/55284; it has been noted by GNATS.

From: David Holland <dholland-pbugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/55284: 'wmweather' broken on architecture where sizeof(long)
 < sizeof(time_t)
Date: Wed, 9 Jun 2021 04:39:46 +0000

 Here's the follow-up email, which got sent to gnats-admin (send PR
 comments to gnats-bugs; stuff sent to the administrator address gets
 mixed with a flood of other things and tends to get lost or severely
 delayed)
 
    ------
 
 From: Romain Dolbeau <romain%dolbeau.org@localhost>
 To: gnats-admin%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost
 Subject: Re: pkg/55284: 'wmweather' broken on architecture where sizeof(long) <
 	sizeof(time_t)
 Date: Fri, 22 May 2020 16:05:24 +0200
 
 This is a patch including the needed fix, adding a properly typed variable 'tl'.
 
 It includes the already-existing patch in pkgsrc.
 
 Cordially,
 
 -- 
 Romain Dolbeau
 
 $NetBSD: patch-wmweather.c,v 1.1 2016/06/23 18:24:07 dholland Exp $
 
 Use ctype.h functions correctly.
 
 --- wmweather.c.orig	2016-08-07 19:02:35.000000000 +0200
 +++ wmweather.c	2020-05-22 15:22:37.658297228 +0200
 @@ -269,7 +269,7 @@
  				exit(1);
  			}
  			for (i = 0; i < 4; i++)
 -				optarg[i] = toupper(optarg[i]);
 +				optarg[i] = toupper((unsigned char)optarg[i]);
  			if (station != NULL)
  				free(station);
  			station = strdup(optarg);
 @@ -406,7 +406,7 @@
  				exit(1);
  			}
  			for (i = 0; i < 4; i++)
 -				optarg[i] = toupper(optarg[i]);
 +				optarg[i] = toupper((unsigned char)optarg[i]);
  			if (station != NULL)
  				free(station);
  			station = optarg;
 @@ -690,11 +690,12 @@
  	char   buffer[MAX_STRING], *i;
  	int    line, n, q, sgn;
  	long   l = 0;
 +	time_t tl = 0;
  
 -	time(&l);
 -	tm = gmtime(&l);
 +	time(&tl);
 +	tm = gmtime(&tl);
  	utc_diff = tm->tm_hour;
 -	tm = localtime(&l);
 +	tm = localtime(&tl);
  	utc_diff = (tm->tm_hour - utc_diff + 24) % 24 * 3600;
  
  	if (stat(report, &rst) < 0 && errno != ENOENT) {
 @@ -1129,8 +1130,8 @@
  
  	} else {
  
 -		time(&l);
 -		tm = localtime(&l);
 +		time(&tl);
 +		tm = localtime(&tl);
  		if (gusting) {
  			showwinddir = tm->tm_sec % 30 < 10;
  			showgusting = tm->tm_sec % 30 >= 10 && tm->tm_sec % 30 < 20;
 
 


Home | Main Index | Thread Index | Old Index