From 42cfb4fa0c63f402f62f90ffa07fea4abb5f431d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 10 Nov 2024 16:16:21 -0800 Subject: [PATCH] inadyn: update to 2.12.0 Backport patch fixing compilation with GCC14. Signed-off-by: Rosen Penev --- net/inadyn/Makefile | 6 +- net/inadyn/patches/010-strdupa.patch | 143 +++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 net/inadyn/patches/010-strdupa.patch diff --git a/net/inadyn/Makefile b/net/inadyn/Makefile index 9cba4adcca..96340858f7 100644 --- a/net/inadyn/Makefile +++ b/net/inadyn/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=inadyn -PKG_VERSION:=2.11.0 +PKG_VERSION:=2.12.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/troglobit/inadyn/releases/download/v$(PKG_VERSION) -PKG_HASH:=9c8b2a425acb9681564e9fc25a319f2109c7d2ebe1ffe99b06d4a722efb6ecba +PKG_HASH:=e64c4386b6f42bbace589b847f22823a755b59f14a277a5f556fef0d99069245 PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0-or-later @@ -47,6 +47,8 @@ CONFIGURE_ARGS += \ --enable-openssl \ --with-pic +TARGET_CFLAGS += -D_GNU_SOURCE + define Package/inadyn/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/inadyn $(1)/usr/sbin/ diff --git a/net/inadyn/patches/010-strdupa.patch b/net/inadyn/patches/010-strdupa.patch new file mode 100644 index 0000000000..de7a0ae12b --- /dev/null +++ b/net/inadyn/patches/010-strdupa.patch @@ -0,0 +1,143 @@ +From b9edfbfb94b3582cf32dfc04e0dd867ecef2ba92 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Sat, 3 Aug 2024 13:25:39 +0200 +Subject: [PATCH] Refactor mkpath() to drop all uses of strdupa() + +Fixes #488 + +Signed-off-by: Joachim Wiberg +--- + include/Makefile.am | 2 +- + include/compat.h | 4 ++-- + include/strdupa.h | 52 ----------------------------------------- + src/makepath.c | 56 ++++++++++++++++++++++++++++++--------------- + src/os.c | 2 +- + 5 files changed, 42 insertions(+), 74 deletions(-) + delete mode 100644 include/strdupa.h + +--- a/include/compat.h ++++ b/include/compat.h +@@ -29,14 +29,14 @@ + #include + #include /* MAX(), isset(), setbit(), TRUE, FALSE, et consortes. :-) */ + #include +-#include "strdupa.h" + + /* From The Practice of Programming, by Kernighan and Pike */ + #ifndef NELEMS + #define NELEMS(array) (sizeof(array) / sizeof(array[0])) + #endif + +-int mkpath (char *dir, mode_t mode); ++int mkpath (const char *dir, mode_t mode); ++int makepath (const char *dir); + + #ifndef pidfile + int pidfile (const char *basename); +--- a/src/makepath.c ++++ b/src/makepath.c +@@ -1,6 +1,6 @@ + /* mkpath() -- Create all components leading up to a given directory + * +- * Copyright (c) 2013-2021 Joachim Wiberg ++ * Copyright (c) 2013-2024 Joachim Wiberg + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -16,11 +16,35 @@ + */ + + #include +-#include +-#include +-#include ++#include /* strdup(), strrchr() */ ++#include /* free() */ ++#include /* mkdir() */ ++ + #include "compat.h" + ++/* Recursively create directories */ ++static int _mkpath(char *dir, mode_t mode) ++{ ++ char *slash; ++ ++ if (!mkdir(dir, mode) || errno == EEXIST) ++ return 0; ++ ++ if (errno != ENOENT) ++ return -1; ++ ++ slash = strrchr(dir, '/'); ++ if (!slash) ++ return -1; ++ ++ *slash = 0; ++ if (_mkpath(dir, mode) == -1) ++ return -1; ++ ++ *slash = '/'; ++ return mkdir(dir, mode); ++} ++ + /** + * mkpath - Like makepath() but takes a mode_t argument + * @dir: Directory to created, relative or absolute +@@ -29,21 +53,24 @@ + * Returns: + * POSIX OK(0) on success, otherwise -1 with @errno set. + */ +-int mkpath(char *dir, mode_t mode) ++int mkpath(const char *dir, mode_t mode) + { +- struct stat sb; ++ char *_dir; ++ int rc; + + if (!dir) { + errno = EINVAL; + return 1; + } + +- if (!stat(dir, &sb)) +- return 0; ++ _dir = strdup(dir); ++ if (!_dir) ++ return -1; + +- mkpath(dirname(strdupa(dir)), mode); ++ rc = _mkpath(_dir, mode); ++ free(_dir); + +- return mkdir(dir, mode); ++ return rc; + } + + /** +@@ -56,14 +83,7 @@ int mkpath(char *dir, mode_t mode) + * fails allocating temporary memory. For other error codes see the + * mkdir() syscall description. + */ +-int makepath(char *dir) ++int makepath(const char *dir) + { + return mkpath(dir, 0777); + } +- +-/** +- * Local Variables: +- * indent-tabs-mode: t +- * c-file-style: "linux" +- * End: +- */ +--- a/src/os.c ++++ b/src/os.c +@@ -266,7 +266,7 @@ int os_check_perms(void) + } + } + +- pidfile_dir = dirname(strdupa(pidfn)); ++ pidfile_dir = dirname(pidfn); + if (access(pidfile_dir, F_OK)) { + if (mkpath(pidfile_dir, 0755) && errno != EEXIST) + logit(LOG_ERR, "No write permission to %s, aborting.", pidfile_dir);