diff --git a/foma-avoid-deprecated-inet-functions.patch b/foma-avoid-deprecated-inet-functions.patch new file mode 100644 index 0000000..32e940f --- /dev/null +++ b/foma-avoid-deprecated-inet-functions.patch @@ -0,0 +1,40 @@ +diff -Nru foma-b44022c7d9d347dc7392aabbf72c82e558767675.orig/foma/flookup.c foma-b44022c7d9d347dc7392aabbf72c82e558767675/foma/flookup.c +--- foma-b44022c7d9d347dc7392aabbf72c82e558767675.orig/foma/flookup.c 2020-09-28 21:00:09.000000000 +0200 ++++ foma-b44022c7d9d347dc7392aabbf72c82e558767675/foma/flookup.c 2021-06-10 13:57:39.337587755 +0200 +@@ -355,6 +355,8 @@ + + void server_init(void) { + unsigned int rcvsize = 262144; ++ int retval; ++ char server_address_string[INET_ADDRSTRLEN]; + + if ((listen_sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { + perror("socket() failed"); +@@ -373,7 +375,15 @@ + serveraddr.sin_family = AF_INET; + serveraddr.sin_port = htons(port_number); + if (server_address != NULL) { +- serveraddr.sin_addr.s_addr = inet_addr(server_address); ++ retval = inet_pton(AF_INET, server_address, &serveraddr.sin_addr.s_addr); ++ if (retval != 1) { ++ if (retval == 0) { ++ printf("inet_pton() failed: string is not a valid address.\n"); ++ exit(1); ++ } ++ perror("inet_pton() failed"); ++ exit(1); ++ } + } else { + serveraddr.sin_addr.s_addr = INADDR_ANY; + } +@@ -381,5 +391,9 @@ + perror("bind() failed"); + exit(1); + } +- printf("Started flookup server on %s port %i\n", inet_ntoa(serveraddr.sin_addr), port_number); fflush(stdout); ++ if (inet_ntop(AF_INET, &serveraddr.sin_addr, server_address_string, INET_ADDRSTRLEN) == NULL) { ++ perror("inet_ntop() failed"); ++ exit(1); ++ } ++ printf("Started flookup server on %s port %i\n", server_address_string, port_number); fflush(stdout); + } diff --git a/foma.spec b/foma.spec index 95a1cfe..73853ec 100644 --- a/foma.spec +++ b/foma.spec @@ -9,7 +9,7 @@ Name: foma Version: 0.9.18 -Release: 0.11.%{snapshotdate}git%{shortcommit0}%{?dist} +Release: 0.12.%{snapshotdate}git%{shortcommit0}%{?dist} Summary: Xerox-compatible finite-state compiler License: ASL 2.0 @@ -26,6 +26,7 @@ Source0: https://github.com/mhulden/%{name}/archive/%{commit0}.tar.gz#/%{ # the linker when building the shared library. For discussion on a similar # issue, see https://lists.debian.org/debian-devel/2016/05/msg00302.html Patch0: foma-harden-build-fedora.patch +Patch1: foma-avoid-deprecated-inet-functions.patch BuildRequires: gcc zlib-devel readline-devel flex bison BuildRequires: make @@ -104,6 +105,9 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';' %changelog +* Thu Jun 10 2021 Mike FABIAN - 0.9.18-0.12.20200928gitb44022c +- Add patch to avoid using deprecated inet_* functions. Related: rhbz#1966963 + * Thu Apr 15 2021 Mohan Boddu - 0.9.18-0.11.20200928gitb44022c - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937