From 5eddba68acf11714d353de22a4b3c030e90a8237 Mon Sep 17 00:00:00 2001 From: David Shepherd <1191800+dtshepherd@users.noreply.github.com> Date: Fri, 2 Feb 2024 00:49:15 -0500 Subject: [PATCH] Patch with v2023.03 changes for obsolete cast and signum handling --- isotptun.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/isotptun.c b/isotptun.c index f889e81..c10ed83 100644 --- a/isotptun.c +++ b/isotptun.c @@ -79,6 +79,7 @@ #define BUF_LEN (MAX_PDU_LENGTH + 1) static volatile int running = 1; +static volatile sig_atomic_t signal_num; static void fake_syslog(int priority, const char *format, ...) { @@ -130,6 +131,7 @@ void print_usage(char *prg) void sigterm(int signo) { running = 0; + signal_num = signo; } int main(int argc, char **argv) @@ -154,13 +156,13 @@ int main(int argc, char **argv) while ((opt = getopt(argc, argv, "s:d:n:x:p:P:t:b:m:whL:vD?")) != -1) { switch (opt) { case 's': - addr.can_addr.tp.tx_id = strtoul(optarg, (char **)NULL, 16); + addr.can_addr.tp.tx_id = strtoul(optarg, NULL, 16); if (strlen(optarg) > 7) addr.can_addr.tp.tx_id |= CAN_EFF_FLAG; break; case 'd': - addr.can_addr.tp.rx_id = strtoul(optarg, (char **)NULL, 16); + addr.can_addr.tp.rx_id = strtoul(optarg, NULL, 16); if (strlen(optarg) > 7) addr.can_addr.tp.rx_id |= CAN_EFF_FLAG; break; @@ -228,19 +230,19 @@ int main(int argc, char **argv) break; case 't': - opts.frame_txtime = strtoul(optarg, (char **)NULL, 10); + opts.frame_txtime = strtoul(optarg, NULL, 10); break; case 'b': - fcopts.bs = strtoul(optarg, (char **)NULL, 16) & 0xFF; + fcopts.bs = strtoul(optarg, NULL, 16) & 0xFF; break; case 'm': - fcopts.stmin = strtoul(optarg, (char **)NULL, 16) & 0xFF; + fcopts.stmin = strtoul(optarg, NULL, 16) & 0xFF; break; case 'w': - fcopts.wftmax = strtoul(optarg, (char **)NULL, 16) & 0xFF; + fcopts.wftmax = strtoul(optarg, NULL, 16) & 0xFF; break; case 'h': @@ -436,5 +438,9 @@ int main(int argc, char **argv) close(s); close(t); + + if (signal_num) + return 128 + signal_num; + return EXIT_SUCCESS; }