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)
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