diff options
| -rw-r--r-- | recipes-extended/diod/diod_1.0.24.bb | 5 | ||||
| -rw-r--r-- | recipes-extended/diod/files/0002-Handle-various-time_t-sizes-in-printf-and-scanf.patch | 100 |
2 files changed, 3 insertions, 102 deletions
diff --git a/recipes-extended/diod/diod_1.0.24.bb b/recipes-extended/diod/diod_1.0.24.bb index d555e5c0..89e79df9 100644 --- a/recipes-extended/diod/diod_1.0.24.bb +++ b/recipes-extended/diod/diod_1.0.24.bb | |||
| @@ -9,16 +9,17 @@ LICENSE = "GPL-2.0-only" | |||
| 9 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" | 9 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" |
| 10 | 10 | ||
| 11 | PV = "1.0.24+git" | 11 | PV = "1.0.24+git" |
| 12 | SRCREV = "b4b5e8e00ed11b21d7fcf05a080dc054a8eac2d6" | 12 | SRCREV = "54d1325fc435d14a6f5c161c88dac79b016b0061" |
| 13 | SRC_URI = "git://github.com/chaos/diod.git;protocol=https;branch=master \ | 13 | SRC_URI = "git://github.com/chaos/diod.git;protocol=https;branch=master \ |
| 14 | file://diod \ | 14 | file://diod \ |
| 15 | file://diod.conf \ | 15 | file://diod.conf \ |
| 16 | file://0001-build-Find-lua-with-pkg-config.patch \ | 16 | file://0001-build-Find-lua-with-pkg-config.patch \ |
| 17 | file://0002-Handle-various-time_t-sizes-in-printf-and-scanf.patch \ | ||
| 18 | " | 17 | " |
| 19 | DEPENDS = "libcap ncurses tcp-wrappers lua" | 18 | DEPENDS = "libcap ncurses tcp-wrappers lua" |
| 20 | 19 | ||
| 21 | EXTRA_OEMAKE += "systemddir=${systemd_unitdir}/system" | 20 | EXTRA_OEMAKE += "systemddir=${systemd_unitdir}/system" |
| 21 | EXTRA_OECONF = "--disable-auth \ | ||
| 22 | --with-systemdsystemunitdir=${systemd_unitdir}/system" | ||
| 22 | 23 | ||
| 23 | S = "${WORKDIR}/git" | 24 | S = "${WORKDIR}/git" |
| 24 | 25 | ||
diff --git a/recipes-extended/diod/files/0002-Handle-various-time_t-sizes-in-printf-and-scanf.patch b/recipes-extended/diod/files/0002-Handle-various-time_t-sizes-in-printf-and-scanf.patch deleted file mode 100644 index 3c13c101..00000000 --- a/recipes-extended/diod/files/0002-Handle-various-time_t-sizes-in-printf-and-scanf.patch +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | From 04b0c5a5cb9e32090b177ff7327ad3260783abe0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ola x Nilsson <olani@axis.com> | ||
| 3 | Date: Mon, 15 Apr 2024 17:31:44 +0200 | ||
| 4 | Subject: [PATCH] Handle various time_t sizes in printf and scanf | ||
| 5 | |||
| 6 | The members of the timeval struct are both signed (defined by POSIX) | ||
| 7 | and typically both 64 bits on a system where time_t is 64 bits. This | ||
| 8 | is possible also on 32 bit systems where time_t is larger to handle | ||
| 9 | the 2038 problem. | ||
| 10 | |||
| 11 | It's practically impossible to find a type and printf format that | ||
| 12 | works even on all glibc systems. Play it safe and always use printf | ||
| 13 | with intmax_t and explict int64_t variables for scanf. | ||
| 14 | |||
| 15 | Upstream-Status: Submitted [https://github.com/chaos/diod/pull/100] | ||
| 16 | Signed-off-by: Ola x Nilsson <olani@axis.com> | ||
| 17 | --- | ||
| 18 | libnpfs/conn.c | 5 +++-- | ||
| 19 | libnpfs/ctl.c | 7 ++++--- | ||
| 20 | utils/dioddate.c | 8 +++++++- | ||
| 21 | 3 files changed, 14 insertions(+), 6 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/libnpfs/conn.c b/libnpfs/conn.c | ||
| 24 | index 6e85fff..c34c840 100644 | ||
| 25 | --- a/libnpfs/conn.c | ||
| 26 | +++ b/libnpfs/conn.c | ||
| 27 | @@ -16,6 +16,7 @@ | ||
| 28 | #include <stdio.h> | ||
| 29 | #include <string.h> | ||
| 30 | #include <stdint.h> | ||
| 31 | +#include <inttypes.h> | ||
| 32 | #include <stdarg.h> | ||
| 33 | #include <errno.h> | ||
| 34 | #include <pthread.h> | ||
| 35 | @@ -133,8 +134,8 @@ _debug_trace (Npsrv *srv, Npfcall *fc) | ||
| 36 | (void)gettimeofday(&b, NULL); | ||
| 37 | (void)gettimeofday(&a, NULL); | ||
| 38 | timersub(&a, &b, &c); | ||
| 39 | - np_logmsg(srv, "[%lu.%-3lu] %s", | ||
| 40 | - c.tv_sec, c.tv_usec/1000, s); | ||
| 41 | + np_logmsg(srv, "[%"PRIdMAX".%-3"PRIdMAX"] %s", | ||
| 42 | + (intmax_t)c.tv_sec, (intmax_t)c.tv_usec/1000, s); | ||
| 43 | } else | ||
| 44 | np_logmsg(srv, "%s", s); | ||
| 45 | } | ||
| 46 | diff --git a/libnpfs/ctl.c b/libnpfs/ctl.c | ||
| 47 | index f40cde4..317a22e 100644 | ||
| 48 | --- a/libnpfs/ctl.c | ||
| 49 | +++ b/libnpfs/ctl.c | ||
| 50 | @@ -16,6 +16,7 @@ | ||
| 51 | #include <stdio.h> | ||
| 52 | #include <string.h> | ||
| 53 | #include <stdint.h> | ||
| 54 | +#include <inttypes.h> | ||
| 55 | #include <stdarg.h> | ||
| 56 | #include <pthread.h> | ||
| 57 | #include <errno.h> | ||
| 58 | @@ -291,9 +292,9 @@ _ctl_get_date (char *name, void *a) | ||
| 59 | np_uerror (errno); | ||
| 60 | goto error; | ||
| 61 | } | ||
| 62 | - if (aspf (&s, &len, "%lu.%lu %d.%d\n", | ||
| 63 | - tv.tv_sec, tv.tv_usec, | ||
| 64 | - tz.tz_minuteswest, tz.tz_dsttime) < 0) { | ||
| 65 | + if (aspf (&s, &len, "%"PRIdMAX".%"PRIdMAX" %d.%d\n", | ||
| 66 | + (uintmax_t)tv.tv_sec, (uintmax_t)tv.tv_usec, | ||
| 67 | + tz.tz_minuteswest, tz.tz_dsttime) < 0) { | ||
| 68 | np_uerror (ENOMEM); | ||
| 69 | goto error; | ||
| 70 | } | ||
| 71 | diff --git a/utils/dioddate.c b/utils/dioddate.c | ||
| 72 | index bde002f..f392792 100644 | ||
| 73 | --- a/utils/dioddate.c | ||
| 74 | +++ b/utils/dioddate.c | ||
| 75 | @@ -21,6 +21,7 @@ | ||
| 76 | #include <unistd.h> | ||
| 77 | #include <stdlib.h> | ||
| 78 | #include <stdint.h> | ||
| 79 | +#include <inttypes.h> | ||
| 80 | #include <stdarg.h> | ||
| 81 | #include <stdio.h> | ||
| 82 | #if HAVE_GETOPT_H | ||
| 83 | @@ -142,11 +143,16 @@ main (int argc, char *argv[]) | ||
| 84 | errn (np_rerror (), "error reading date"); | ||
| 85 | goto done; | ||
| 86 | } | ||
| 87 | - if (sscanf (buf, "%lu.%lu %d.%d", &tv.tv_sec, &tv.tv_usec, | ||
| 88 | + | ||
| 89 | + int64_t sec = 0, usec = 0; | ||
| 90 | + if (sscanf (buf, "%"SCNd64".%"SCNd64" %d.%d", &sec, &usec, | ||
| 91 | &tz.tz_minuteswest, &tz.tz_dsttime) != 4) { | ||
| 92 | msg ("error scanning returned date: %s", buf); | ||
| 93 | goto done; | ||
| 94 | } | ||
| 95 | + tv.tv_sec = sec; | ||
| 96 | + tv.tv_usec = usec; | ||
| 97 | + | ||
| 98 | if (Sopt) { | ||
| 99 | if (settimeofday (&tv, &tz) < 0) | ||
| 100 | err_exit ("settimeofday"); | ||
