git: 2f04ed793d6b - main - ftp/wzdftpd: fix build with LLVM 15

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Tue, 14 Feb 2023 20:23:56 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2f04ed793d6bf5cf4eb923eee9070769eb5154b6

commit 2f04ed793d6bf5cf4eb923eee9070769eb5154b6
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-02-11 12:30:40 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-02-14 20:23:41 +0000

    ftp/wzdftpd: fix build with LLVM 15
    
    Seems like the compiler got a whole lot stricter with this release.
    The biggest fix was changing the thread ID from unsigned long to
    pthread_t, which will probably break compilation on Win32.
    
    While we are at it, replace static uses of REINPLACE_CMD with patch
    files as per policy.  This change is responsible for most of the
    newly added patches.
    
    The wzdftpd build scripts want to install plugins into ${PREFIX}/share
    when they belong into ${PREFIX}/lib.  Instead of patching this in each
    Makefile.am, set --datadir=${PREFIX}/lib and work around the one file
    for which this is wrong.
    
    Approved by:    eduardo (mentor)
    Differential Revision: https://reviews.freebsd.org/D38523
---
 ftp/wzdftpd/Makefile                               | 25 ++++++----------------
 ftp/wzdftpd/files/patch-Makefile.am                |  7 ++++++
 ftp/wzdftpd/files/patch-ac-helpers__tls.m4         |  4 ++--
 ftp/wzdftpd/files/patch-libwzd-auth_wzd__md5.c     | 11 ++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_Makefile.am    | 11 ++++++++++
 .../files/patch-libwzd-core_wzd__cookie__lex.l     | 11 ++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__debug.c   | 11 ++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__libmain.c | 10 +++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__list.c    | 11 ++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.c    | 20 +++++++++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.h    | 20 +++++++++++++++++
 .../files/patch-libwzd-core_wzd__site__user.c      | 14 ++++++++++++
 ftp/wzdftpd/files/patch-libwzd-core_wzd__structs.h | 13 +++++++++++
 ...core_wzd_tls.c => patch-libwzd-core_wzd__tls.c} | 20 +++++++++++++++--
 ftp/wzdftpd/files/patch-libwzd-perl_Makefile.am    | 19 ++++++++++++++++
 ftp/wzdftpd/files/patch-libwzd_libwzd__tls.c       | 10 +++++++++
 .../files/patch-modules_sfv_libwzd__sfv__main.h    | 11 ++++++++++
 .../files/patch-wzdftpd_wzd__ServerThread.c        | 25 ++++++++++++++++++++++
 ftp/wzdftpd/files/patch-wzdftpd_wzd__opts.h        | 14 ++++++++++++
 19 files changed, 244 insertions(+), 23 deletions(-)

diff --git a/ftp/wzdftpd/Makefile b/ftp/wzdftpd/Makefile
index f62d71daed52..92e66fd04320 100644
--- a/ftp/wzdftpd/Makefile
+++ b/ftp/wzdftpd/Makefile
@@ -13,7 +13,8 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 USES=		autoreconf:2.69 cpe gettext-tools libtool localbase pkgconfig
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--sysconfdir=${ETCDIR} --disable-bonjour --disable-static
+CONFIGURE_ARGS=	--sysconfdir=${ETCDIR} --datadir=${PREFIX}/lib \
+		--disable-bonjour --disable-static
 INSTALL_TARGET=	install-strip
 USE_LDCONFIG=	yes
 
@@ -62,26 +63,12 @@ AVAHI_LIB_DEPENDS=	libdbus-1.so:devel/dbus \
 
 post-patch:
 	@${TOUCH} ${WRKSRC}/config.rpath
-	@${ECHO_CMD} "ACLOCAL_AMFLAGS= -I ac-helpers" >> ${WRKSRC}/Makefile.am
-	@${REINPLACE_CMD} -e \
-		'/LDFLAGS/s|@PTHREAD_CFLAGS@|@LTLIBICONV@|' \
-		${WRKSRC}/libwzd-core/Makefile.am
-	@${REINPLACE_CMD} -e \
-		's|INSTALLDIRS=vendor|INSTALLPRIVLIB=$${prefix}/lib| ; \
-		 /MAKE/s| install| pure_install|' \
-		${WRKSRC}/libwzd-perl/Makefile.am
-.for i in backends modules
-	@${FIND} ${WRKSRC}/${i} -name "Makefile.am" | ${XARGS} \
-		${REINPLACE_CMD} -e \
-		'/^libdir/s|$${pkgdatadir}|$${prefix}/lib/wzdftpd|'
-.endfor
-	@${FIND} ${WRKSRC} -name "*_tls.c" | ${XARGS} ${REINPLACE_CMD} -e \
-		'/<gcrypt\.h>/d ; /gcry_control/d'
-	@${REINPLACE_CMD} -e \
-		's|^wzd_sfv_config SfvConfig|extern &|' \
-		${WRKSRC}/modules/sfv/libwzd_sfv_main.h
 
+# wzd.m4 gets installed into the wrong spot due to our --datadir hack
 post-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/aclocal
+	${MV} ${STAGEDIR}${PREFIX}/lib/aclocal/wzd.m4 ${STAGEDIR}${PREFIX}/share/aclocal
+	${RMDIR} ${STAGEDIR}${PREFIX}/lib/aclocal
 	${INSTALL_DATA} ${WRKSRC}/*.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig
 
 post-install-DOCS-on:
diff --git a/ftp/wzdftpd/files/patch-Makefile.am b/ftp/wzdftpd/files/patch-Makefile.am
new file mode 100644
index 000000000000..f2a7a7e25eec
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-Makefile.am
@@ -0,0 +1,7 @@
+--- Makefile.am.orig	2023-02-11 10:33:06 UTC
++++ Makefile.am
+@@ -20,3 +20,4 @@ doxy:
+ 	doxygen doxygen.cfg
+ 
+ 
++ACLOCAL_AMFLAGS= -I ac-helpers
diff --git a/ftp/wzdftpd/files/patch-ac-helpers__tls.m4 b/ftp/wzdftpd/files/patch-ac-helpers__tls.m4
index 86f9dd704ec5..82113e8d212f 100644
--- a/ftp/wzdftpd/files/patch-ac-helpers__tls.m4
+++ b/ftp/wzdftpd/files/patch-ac-helpers__tls.m4
@@ -1,6 +1,6 @@
---- ac-helpers/tls.m4.orig
+--- ac-helpers/tls.m4.orig	2004-10-26 11:14:48 UTC
 +++ ac-helpers/tls.m4
-@@ -22,7 +22,7 @@
+@@ -22,7 +22,7 @@ AC_DEFUN([WZD_TLS],
    )
  
  if test "$gnutls" = "yes"; then
diff --git a/ftp/wzdftpd/files/patch-libwzd-auth_wzd__md5.c b/ftp/wzdftpd/files/patch-libwzd-auth_wzd__md5.c
new file mode 100644
index 000000000000..773535058d45
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-auth_wzd__md5.c
@@ -0,0 +1,11 @@
+--- libwzd-auth/wzd_md5.c.orig	2023-02-11 10:36:30 UTC
++++ libwzd-auth/wzd_md5.c
+@@ -158,7 +158,7 @@ void MD5Name(MD5Final)(unsigned char digest[16], struc
+     MD5Name(MD5Transform)(ctx->buf, (uint32 *) ctx->in);
+     byteReverse((unsigned char *) ctx->buf, 4);
+     memcpy(digest, ctx->buf, 16);
+-    memset(ctx, 0, sizeof(ctx));	/* In case it's sensitive */
++    explicit_bzero(ctx, sizeof *ctx);  /* In case it's sensitive */
+ }
+ 
+ #ifndef ASM_MD5
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_Makefile.am b/ftp/wzdftpd/files/patch-libwzd-core_Makefile.am
new file mode 100644
index 000000000000..5b07a8331d15
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_Makefile.am
@@ -0,0 +1,11 @@
+--- libwzd-core/Makefile.am.orig	2007-04-14 10:02:19 UTC
++++ libwzd-core/Makefile.am
+@@ -101,7 +101,7 @@ libwzd_core_la_SOURCES = \
+ 
+ 
+ libwzd_core_la_LIBADD = ../libwzd-base/libwzd_base.la ../libwzd-auth/libwzd_auth.la
+-libwzd_core_la_LDFLAGS = @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -version-info $(LT_VERSION_INFO) -export-dynamic -no-undefined
++libwzd_core_la_LDFLAGS = @LTLIBICONV@ @PTHREAD_LIBS@ -version-info $(LT_VERSION_INFO) -export-dynamic -no-undefined
+ 
+ AM_CPPFLAGS = -I$(top_srcdir) $(WZD_SSL_INCLUDES) -DWZD_MULTITHREAD -D_REENTRANT @PTHREAD_CFLAGS@
+ 
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__cookie__lex.l b/ftp/wzdftpd/files/patch-libwzd-core_wzd__cookie__lex.l
new file mode 100644
index 000000000000..df3cb1193e1f
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__cookie__lex.l
@@ -0,0 +1,11 @@
+--- libwzd-core/wzd_cookie_lex.l.orig	2023-02-11 11:26:34 UTC
++++ libwzd-core/wzd_cookie_lex.l
+@@ -1731,7 +1731,7 @@ out_err(LEVEL_HIGH,"char: %d [%c]\n", c, c);
+       {
+         /* check FLAG_SITEOP for self */
+         if (me && me->flags && strchr(me->flags,FLAG_SITEOP))
+-          snprintf(internalbuffer,IBUFSIZE,"%lu",current_context->pid_child);
++          snprintf(internalbuffer,IBUFSIZE,"%lu",(unsigned long)current_context->pid_child);
+         else
+           snprintf(internalbuffer,IBUFSIZE,"some id");
+       }
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__debug.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__debug.c
new file mode 100644
index 000000000000..65d9c7ff7a7f
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__debug.c
@@ -0,0 +1,11 @@
+--- libwzd-core/wzd_debug.c.orig	2023-02-11 11:21:12 UTC
++++ libwzd-core/wzd_debug.c
+@@ -318,7 +318,7 @@ int check_context(wzd_context_t * context)
+     out_err(LEVEL_CRITICAL,"CRITICAL context      %p\n",context);
+     return 1;
+   }
+-  if (!context->magic == CONTEXT_MAGIC)
++  if (context->magic != CONTEXT_MAGIC)
+   {
+     out_err(LEVEL_CRITICAL,"CRITICAL context->magic is invalid, context may be corrupted\n");
+     return 1;
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__libmain.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__libmain.c
new file mode 100644
index 000000000000..75aceb496a28
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__libmain.c
@@ -0,0 +1,10 @@
+--- libwzd-core/wzd_libmain.c.orig	2023-02-11 10:43:55 UTC
++++ libwzd-core/wzd_libmain.c
+@@ -285,7 +285,6 @@ void context_init(wzd_context_t * context)
+   context->datafd = -1;
+   context->pasvsock = -1;
+   context->userid = (unsigned int)-1;
+-  context->thread_id = (unsigned long)-1;
+   context->state = STATE_UNKNOWN;
+   context->datamode = DATA_PORT;
+   context->current_action.current_file = -1;
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__list.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__list.c
new file mode 100644
index 000000000000..f92ddcfd6199
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__list.c
@@ -0,0 +1,11 @@
+--- libwzd-core/wzd_list.c.orig	2023-02-11 11:22:20 UTC
++++ libwzd-core/wzd_list.c
+@@ -277,7 +277,7 @@ char * mlst_single_file(const char *filename, wzd_cont
+ 
+   ptr = strrchr(filename,'/');
+   if (!ptr) return NULL;
+-  if (ptr+1 != '\0') ptr++;
++  if (ptr[1] != '\0') ptr++;
+ 
+   /** \bug this kills VFS */
+ /*  if (fs_file_lstat(filename,&s)) return -1;*/
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.c
new file mode 100644
index 000000000000..ed386b049674
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.c
@@ -0,0 +1,20 @@
+--- libwzd-core/wzd_misc.c.orig	2023-02-11 11:23:37 UTC
++++ libwzd-core/wzd_misc.c
+@@ -990,7 +990,7 @@ void win_normalize(char * s, unsigned int length, unsi
+ 
+ 
+ /* \return 0 if ok, -1 if error, 1 if trying to kill myself */
+-int kill_child_signal(unsigned long pid, wzd_context_t * context)
++int kill_child_signal(pthread_t pid, wzd_context_t * context)
+ {
+   ListElmt * elmnt;
+   wzd_context_t * loop_context;
+@@ -1022,7 +1022,7 @@ int kill_child_signal(unsigned long pid, wzd_context_t
+ }
+ 
+ /* \return 0 if ok, -1 if error, 1 if trying to kill myself */
+-int kill_child_new(unsigned long pid, wzd_context_t * context)
++int kill_child_new(pthread_t pid, wzd_context_t * context)
+ {
+   ListElmt * elmnt;
+   int found=0;
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.h b/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.h
new file mode 100644
index 000000000000..d2e57f88cb9d
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__misc.h
@@ -0,0 +1,20 @@
+--- libwzd-core/wzd_misc.h.orig	2023-02-11 11:24:33 UTC
++++ libwzd-core/wzd_misc.h
+@@ -52,7 +52,7 @@ int split_filename(const char *filename, char *path, c
+  * If the client is inside a function, it is stopped immediatly,
+  * maybe creating some problems.
+  */
+-int kill_child_signal(unsigned long pid, wzd_context_t * context);
++int kill_child_signal(pthread_t pid, wzd_context_t * context);
+ 
+ /** \brief Kill child
+  *
+@@ -61,7 +61,7 @@ int kill_child_signal(unsigned long pid, wzd_context_t
+  * If the client is inside a function, it will exit after the function
+  * is finished.
+  */
+-int kill_child_new(unsigned long pid, wzd_context_t * context);
++int kill_child_new(pthread_t pid, wzd_context_t * context);
+ 
+ /* returns system ip on specifed interface (e.g eth0) */
+ int get_system_ip(const char * itface, struct in_addr * ina);
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__site__user.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__site__user.c
new file mode 100644
index 000000000000..0002c910cb1c
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__site__user.c
@@ -0,0 +1,14 @@
+--- libwzd-core/wzd_site_user.c.orig	2023-02-11 11:29:18 UTC
++++ libwzd-core/wzd_site_user.c
+@@ -1224,9 +1224,9 @@ int do_site_kill(UNUSED wzd_string_t *ignored, wzd_str
+ {
+   char *ptr;
+   int ret;
+-  unsigned long pid;
++  pthread_t pid;
+ 
+-  pid = strtoul(str_tochar(param),&ptr,0);
++  pid = (pthread_t)strtoul(str_tochar(param),&ptr,0);
+   if (*ptr!='\0') {
+     ret = send_message_with_args(501,context,"Usage: site kill <pid>");
+     return 0;
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd__structs.h b/ftp/wzdftpd/files/patch-libwzd-core_wzd__structs.h
new file mode 100644
index 000000000000..b5e6090d8d64
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__structs.h
@@ -0,0 +1,13 @@
+--- libwzd-core/wzd_structs.h.orig	2007-05-17 09:54:38 UTC
++++ libwzd-core/wzd_structs.h
+@@ -366,8 +366,8 @@ struct wzd_context_t {
+   data_mode_t   datamode;
+   tls_data_mode_t    tls_data_mode;
+   net_family_t  datafamily; /**< \brief IPv4 or IPv6 */
+-  unsigned long	pid_child;
+-  unsigned long	thread_id;
++  pthread_t	pid_child;
++  pthread_t	thread_id;
+ 
+   union wzd_thread_t * transfer_thread;
+   u8_t          is_transferring;
diff --git a/ftp/wzdftpd/files/patch-libwzd-core_wzd_tls.c b/ftp/wzdftpd/files/patch-libwzd-core_wzd__tls.c
similarity index 77%
rename from ftp/wzdftpd/files/patch-libwzd-core_wzd_tls.c
rename to ftp/wzdftpd/files/patch-libwzd-core_wzd__tls.c
index c474a2fecf96..ef82b2db639b 100644
--- a/ftp/wzdftpd/files/patch-libwzd-core_wzd_tls.c
+++ b/ftp/wzdftpd/files/patch-libwzd-core_wzd__tls.c
@@ -9,7 +9,23 @@
    }
  
    SSL_CTX_set_session_cache_mode(tls_ctx, SSL_SESS_CACHE_CLIENT);
-@@ -946,19 +946,13 @@ int tls_exit(void)
+@@ -779,7 +779,6 @@ void * ssl_get_obj(wzd_context_t * context)
+ #include <stdio.h>
+ 
+ #include <gnutls/gnutls.h>
+-#include <gcrypt.h>
+ #include <errno.h>
+ #include <pthread.h>
+ GCRY_THREAD_OPTION_PTHREAD_IMPL;
+@@ -892,7 +891,6 @@ int tls_init(void)
+ 
+   /* The order matters.
+    */
+-  gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+   gnutls_global_init();
+ 
+   /** \todo TODO XXX move this code to global init ? */
+@@ -946,19 +944,13 @@ int tls_exit(void)
  
  static gnutls_session initialize_tls_session(gnutls_connection_end con_end)
  {
@@ -31,7 +47,7 @@
  
    gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
  
-@@ -1001,27 +995,6 @@ int tls_auth (const char *type, wzd_context_t * contex
+@@ -1001,27 +993,6 @@ int tls_auth (const char *type, wzd_context_t * contex
    }
  
    /** \todo XXX parse TLS cipher names */
diff --git a/ftp/wzdftpd/files/patch-libwzd-perl_Makefile.am b/ftp/wzdftpd/files/patch-libwzd-perl_Makefile.am
new file mode 100644
index 000000000000..488f712c251d
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd-perl_Makefile.am
@@ -0,0 +1,19 @@
+--- libwzd-perl/Makefile.am.orig	2006-06-13 07:34:54 UTC
++++ libwzd-perl/Makefile.am
+@@ -7,14 +7,14 @@ ext: ext/Makefile ext/wzdftpd.pm ../libwzd/libwzd.la
+ 	cd ext && $(MAKE) LD_RUN_PATH=""
+ 
+ ext/Makefile: ext/Makefile.PL ext/wzdftpd.pm ext/wzdftpd.xs
+-	cd ext && $(PERL) Makefile.PL $(PERLFLAGS) $(PERL_MAKE_OPTIONS) INSTALLDIRS=vendor
++	cd ext && $(PERL) Makefile.PL $(PERLFLAGS) $(PERL_MAKE_OPTIONS) INSTALLPRIVLIB=${prefix}/lib
+ 
+ 
+ all-local: ext
+ 
+ install-data-local: all-local
+ 	echo "Installing wzdftpd.pm"; \
+-	cd ext && $(MAKE) install
++	cd ext && $(MAKE) pure_install
+ 
+ clean-local:
+ 	cd ext && test -f Makefile && $(MAKE) clean || true \
diff --git a/ftp/wzdftpd/files/patch-libwzd_libwzd__tls.c b/ftp/wzdftpd/files/patch-libwzd_libwzd__tls.c
new file mode 100644
index 000000000000..5eb361999071
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-libwzd_libwzd__tls.c
@@ -0,0 +1,10 @@
+--- libwzd/libwzd_tls.c.orig	2006-09-19 13:28:28 UTC
++++ libwzd/libwzd_tls.c
+@@ -153,7 +153,6 @@ int tls_write(const char *buffer, int length)
+ #elif HAVE_GNUTLS
+ 
+ #include <gnutls/gnutls.h>
+-#include <gcrypt.h>
+ 
+ #define DH_BITS 1024
+ 
diff --git a/ftp/wzdftpd/files/patch-modules_sfv_libwzd__sfv__main.h b/ftp/wzdftpd/files/patch-modules_sfv_libwzd__sfv__main.h
new file mode 100644
index 000000000000..6024a6e19c8b
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-modules_sfv_libwzd__sfv__main.h
@@ -0,0 +1,11 @@
+--- modules/sfv/libwzd_sfv_main.h.orig	2006-05-29 16:45:55 UTC
++++ modules/sfv/libwzd_sfv_main.h
+@@ -15,7 +15,7 @@ typedef struct {
+   double size_total;
+ } wzd_release_stats;
+ 
+-wzd_sfv_config SfvConfig; /*Our main SFV config */
++extern wzd_sfv_config SfvConfig; /*Our main SFV config */
+ char * create_filepath(const char *dir, const char * file);
+ 
+ 
diff --git a/ftp/wzdftpd/files/patch-wzdftpd_wzd__ServerThread.c b/ftp/wzdftpd/files/patch-wzdftpd_wzd__ServerThread.c
new file mode 100644
index 000000000000..006eef86654c
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-wzdftpd_wzd__ServerThread.c
@@ -0,0 +1,25 @@
+--- wzdftpd/wzd_ServerThread.c.orig	2023-02-11 11:33:03 UTC
++++ wzdftpd/wzd_ServerThread.c
+@@ -934,7 +934,7 @@ static void server_login_accept(wzd_context_t * contex
+     out_err(LEVEL_CRITICAL,"Unable to create thread\n");
+     return;
+   }
+-  context->pid_child = (unsigned long)WZD_THREAD_VOID(&thread);
++  context->pid_child = (pthread_t)WZD_THREAD_VOID(&thread);
+   wzd_thread_attr_destroy(&thread_attr); /* not needed anymore */
+ }
+ 
+@@ -1624,10 +1624,12 @@ void serverMainThreadCleanup(int retcode)
+   {
+     ListElmt * elmnt;
+     wzd_context_t * loop_context;
++    wzd_thread_t child;
+     for (elmnt=list_head(context_list); elmnt!=NULL; elmnt=list_next(elmnt))
+     {
+       if ((loop_context = list_data(elmnt))) {
+-        wzd_thread_cancel(loop_context->pid_child);
++        child._t = loop_context->pid_child;
++        wzd_thread_cancel(&child);
+ #ifdef WIN32
+         /** \todo remove this when wzd_thread_cancel is implemented on windows */
+         loop_context->exitclient = 1;
diff --git a/ftp/wzdftpd/files/patch-wzdftpd_wzd__opts.h b/ftp/wzdftpd/files/patch-wzdftpd_wzd__opts.h
new file mode 100644
index 000000000000..b1d9c4845749
--- /dev/null
+++ b/ftp/wzdftpd/files/patch-wzdftpd_wzd__opts.h
@@ -0,0 +1,14 @@
+--- wzdftpd/wzd_opts.h.orig	2023-02-11 11:32:00 UTC
++++ wzdftpd/wzd_opts.h
+@@ -24,11 +24,7 @@ struct option
+ #define optional_argument       2
+ 
+ #if __STDC__
+-#if defined(__GNU_LIBRARY__)
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
+-#else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
+-#endif /* not __GNU_LIBRARY__ */
+ extern int getopt_long (int argc, char *const *argv, const char
+ *shortopts,                        const struct option *longopts, int
+ *longind); extern int getopt_long_only (int argc, char *const *argv,