]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/commitdiff
tftpd: Fix build with GCC 14
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Aug 2024 15:00:51 +0000 (15:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 19 Aug 2024 10:01:01 +0000 (10:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/tftpd
src/patches/tftp-c99.patch [new file with mode: 0644]

index 8a3e7bd3122a2a200d20a6ef6d1ef1d94ab59c4b..ebd8fee85b54e1eced62271d00120b2b50889389 100644 (file)
--- a/lfs/tftpd
+++ b/lfs/tftpd
@@ -34,7 +34,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = tftpd
-PAK_VER    = 4
+PAK_VER    = 5
 
 DEPS       =
 
@@ -83,6 +83,7 @@ $(subst %,%_BLAKE2,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/tftp-c99.patch
        cd $(DIR_APP) && ./configure --prefix=/usr --without-tcpwrappers
        cd $(DIR_APP) && make $(MAKETUNING)
        cd $(DIR_APP) && make install
diff --git a/src/patches/tftp-c99.patch b/src/patches/tftp-c99.patch
new file mode 100644 (file)
index 0000000..40bb4dd
--- /dev/null
@@ -0,0 +1,50 @@
+The glibc headers do not declare bsd_signal by default.  Call signal
+instead, which is the same function as bsd_signal in current glibc.
+
+This fixes implicit function declarations and avoids build issues with
+future compilers.
+
+diff --git a/tftp/main.c b/tftp/main.c
+index fcf5a25ac654954b..7e399d414ca0dd2b 100644
+--- a/tftp/main.c
++++ b/tftp/main.c
+@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
+         sp->s_proto = (char *)"udp";
+     }
+-    bsd_signal(SIGINT, intr);
++    signal(SIGINT, intr);
+     if (peerargc) {
+         /* Set peer */
+@@ -791,7 +791,7 @@ void intr(int sig)
+ {
+     (void)sig;                  /* Quiet unused warning */
+-    bsd_signal(SIGALRM, SIG_IGN);
++    signal(SIGALRM, SIG_IGN);
+     alarm(0);
+     siglongjmp(toplevel, -1);
+ }
+diff --git a/tftp/tftp.c b/tftp/tftp.c
+index 109848c4f9a5ad4e..d31553be5b76e305 100644
+--- a/tftp/tftp.c
++++ b/tftp/tftp.c
+@@ -85,7 +85,7 @@ void tftp_sendfile(int fd, const char *name, const char *mode)
+     is_request = 1;             /* First packet is the actual WRQ */
+     amount = 0;
+-    bsd_signal(SIGALRM, timer);
++    signal(SIGALRM, timer);
+     do {
+         if (is_request) {
+             size = makerequest(WRQ, name, dp, mode) - 4;
+@@ -191,7 +191,7 @@ void tftp_recvfile(int fd, const char *name, const char *mode)
+     firsttrip = 1;
+     amount = 0;
+-    bsd_signal(SIGALRM, timer);
++    signal(SIGALRM, timer);
+     do {
+         if (firsttrip) {
+             size = makerequest(RRQ, name, ap, mode);