x11/wmweather: apply patch from Romain Dolbeau in PR 55284. Fixes time_t abuse leading to crashes on 32-bit platforms.diff -r1.66 -r1.67 pkgsrc/x11/wmweather/Makefile
(dholland)
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | # $NetBSD: Makefile,v 1.66 2021/04/21 13:25:33 adam Exp $ | 1 | # $NetBSD: Makefile,v 1.67 2021/07/10 17:13:44 dholland Exp $ | |
2 | 2 | |||
3 | DISTNAME= wmweather-2.4.7 | 3 | DISTNAME= wmweather-2.4.7 | |
4 | PKGREVISION= 1 | 4 | PKGREVISION= 2 | |
5 | CATEGORIES= x11 | 5 | CATEGORIES= x11 | |
6 | MASTER_SITES= https://people.debian.org/~godisch/wmweather/ | 6 | MASTER_SITES= https://people.debian.org/~godisch/wmweather/ | |
7 | 7 | |||
8 | MAINTAINER= pkgsrc-users@NetBSD.org | 8 | MAINTAINER= pkgsrc-users@NetBSD.org | |
9 | HOMEPAGE= https://people.debian.org/~godisch/ | 9 | HOMEPAGE= https://people.debian.org/~godisch/ | |
10 | COMMENT= WindowMaker DockApp showing local weather conditions | 10 | COMMENT= WindowMaker DockApp showing local weather conditions | |
11 | LICENSE= gnu-gpl-v2 | 11 | LICENSE= gnu-gpl-v2 | |
12 | 12 | |||
13 | WRKSRC= ${WRKDIR}/${DISTNAME}/src | 13 | WRKSRC= ${WRKDIR}/${DISTNAME}/src | |
14 | 14 | |||
15 | GNU_CONFIGURE= yes | 15 | GNU_CONFIGURE= yes | |
16 | USE_TOOLS+= gmake xmessage:run | 16 | USE_TOOLS+= gmake xmessage:run | |
17 | 17 |
@@ -1,8 +1,8 @@ | @@ -1,8 +1,8 @@ | |||
1 | $NetBSD: distinfo,v 1.13 2020/09/13 20:12:08 wiz Exp $ | 1 | $NetBSD: distinfo,v 1.14 2021/07/10 17:13:44 dholland Exp $ | |
2 | 2 | |||
3 | SHA1 (wmweather-2.4.7.tar.gz) = a227b0efe8e141e6fde0dbe21a6bfb9cad026aab | 3 | SHA1 (wmweather-2.4.7.tar.gz) = a227b0efe8e141e6fde0dbe21a6bfb9cad026aab | |
4 | RMD160 (wmweather-2.4.7.tar.gz) = 1dae2f985f6b2cbd48da9a0b3adc1ced91b693bb | 4 | RMD160 (wmweather-2.4.7.tar.gz) = 1dae2f985f6b2cbd48da9a0b3adc1ced91b693bb | |
5 | SHA512 (wmweather-2.4.7.tar.gz) = d9d0c46e85a24aaa278aa75e0fcd51fc417c3c094d9e69c5820a288955c3ebdde21a24b26964824d9275a41ec053e3d942b185b24088d806e033e311e6e09108 | 5 | SHA512 (wmweather-2.4.7.tar.gz) = d9d0c46e85a24aaa278aa75e0fcd51fc417c3c094d9e69c5820a288955c3ebdde21a24b26964824d9275a41ec053e3d942b185b24088d806e033e311e6e09108 | |
6 | Size (wmweather-2.4.7.tar.gz) = 86220 bytes | 6 | Size (wmweather-2.4.7.tar.gz) = 86220 bytes | |
7 | SHA1 (patch-aa) = a882d59ff36a5fb23822ab9288c48f62edc094d8 | 7 | SHA1 (patch-aa) = a882d59ff36a5fb23822ab9288c48f62edc094d8 | |
8 | SHA1 (patch-wmweather.c) = ef7e6a9ebc4bd28c3b99bf49715f8e02f670028a | 8 | SHA1 (patch-wmweather.c) = 7c5e0f3e379e82333dbdd7b6799e4398dc06e815 |
@@ -1,24 +1,52 @@ | @@ -1,24 +1,52 @@ | |||
1 | $NetBSD: patch-wmweather.c,v 1.1 2016/06/23 18:24:07 dholland Exp $ | 1 | $NetBSD: patch-wmweather.c,v 1.2 2021/07/10 17:13:44 dholland Exp $ | |
2 | 2 | |||
3 | Use ctype.h functions correctly. | 3 | Use ctype.h functions correctly. | |
4 | Use the proper type with time(). | |||
4 | 5 | |||
5 | --- wmweather.c~ 2009-07-03 16:00:38.000000000 +0000 | 6 | --- wmweather.c.orig 2019-02-13 19:54:49.000000000 +0000 | |
6 | +++ wmweather.c | 7 | +++ wmweather.c | |
7 | @@ -270,7 +270,7 @@ static void do_conf(const char *rcfile) | 8 | @@ -269,7 +269,7 @@ static void do_conf(const char *rcfile) | |
8 | exit(1); | 9 | exit(1); | |
9 | } | 10 | } | |
10 | for (i = 0; i < 4; i++) | 11 | for (i = 0; i < 4; i++) | |
11 | - optarg[i] = toupper(optarg[i]); | 12 | - optarg[i] = toupper(optarg[i]); | |
12 | + optarg[i] = toupper((unsigned char)optarg[i]); | 13 | + optarg[i] = toupper((unsigned char)optarg[i]); | |
13 | if (station != NULL) | 14 | if (station != NULL) | |
14 | free(station); | 15 | free(station); | |
15 | station = strdup(optarg); | 16 | station = strdup(optarg); | |
16 | @@ -407,7 +407,7 @@ static void do_opts(int argc, char *argv | 17 | @@ -406,7 +406,7 @@ static void do_opts(int argc, char *argv | |
17 | exit(1); | 18 | exit(1); | |
18 | } | 19 | } | |
19 | for (i = 0; i < 4; i++) | 20 | for (i = 0; i < 4; i++) | |
20 | - optarg[i] = toupper(optarg[i]); | 21 | - optarg[i] = toupper(optarg[i]); | |
21 | + optarg[i] = toupper((unsigned char)optarg[i]); | 22 | + optarg[i] = toupper((unsigned char)optarg[i]); | |
22 | if (station != NULL) | 23 | if (station != NULL) | |
23 | free(station); | 24 | free(station); | |
24 | station = optarg; | 25 | station = optarg; | |
26 | @@ -690,11 +690,12 @@ static void update(int force_read) | |||
27 | char buffer[MAX_STRING], *i; | |||
28 | int line, n, q, sgn; | |||
29 | long l = 0; | |||
30 | + time_t tl; | |||
31 | ||||
32 | - time(&l); | |||
33 | - tm = gmtime(&l); | |||
34 | + time(&tl); | |||
35 | + tm = gmtime(&tl); | |||
36 | utc_diff = tm->tm_hour; | |||
37 | - tm = localtime(&l); | |||
38 | + tm = localtime(&tl); | |||
39 | utc_diff = (tm->tm_hour - utc_diff + 24) % 24 * 3600; | |||
40 | ||||
41 | if (stat(report, &rst) < 0 && errno != ENOENT) { | |||
42 | @@ -1129,8 +1130,8 @@ static void update(int force_read) | |||
43 | ||||
44 | } else { | |||
45 | ||||
46 | - time(&l); | |||
47 | - tm = localtime(&l); | |||
48 | + time(&tl); | |||
49 | + tm = localtime(&tl); | |||
50 | if (gusting) { | |||
51 | showwinddir = tm->tm_sec % 30 < 10; | |||
52 | showgusting = tm->tm_sec % 30 >= 10 && tm->tm_sec % 30 < 20; |