From 733386dd8dde1fdde728d2b7f127b2108b5dd57e Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 27 Jan 2023 10:52:15 +0100 Subject: [PATCH] Fix C99 compatibility issues (#2164996) Related to: --- lrzsz-c99.patch | 33 ++++++++ lrzsz-configure-c99.patch | 153 ++++++++++++++++++++++++++++++++++++++ lrzsz.spec | 9 ++- 3 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 lrzsz-c99.patch create mode 100644 lrzsz-configure-c99.patch diff --git a/lrzsz-c99.patch b/lrzsz-c99.patch new file mode 100644 index 0000000..f81fb55 --- /dev/null +++ b/lrzsz-c99.patch @@ -0,0 +1,33 @@ +Add additional #include directives to avoid implicit function +declarations and build failures with future compilers. + +diff --git a/lib/long-options.c b/lib/long-options.c +index 76b979634aa4be46..9ee8f6609cdd2c2b 100644 +--- a/lib/long-options.c ++++ b/lib/long-options.c +@@ -22,6 +22,7 @@ + #endif + + #include ++#include + #include + #include "long-options.h" + +diff --git a/src/lsyslog.c b/src/lsyslog.c +index 6baf4a2b0a372fc5..0500280259b1af0a 100644 +--- a/src/lsyslog.c ++++ b/src/lsyslog.c +@@ -18,11 +18,13 @@ + 02111-1307, USA. + + */ ++#define _GNU_SOURCE /* for vasprintf */ + #include "config.h" + #ifdef ENABLE_SYSLOG + #include "zglobal.h" + #include + #include ++#include + #include + #endif + diff --git a/lrzsz-configure-c99.patch b/lrzsz-configure-c99.patch new file mode 100644 index 0000000..912ae49 --- /dev/null +++ b/lrzsz-configure-c99.patch @@ -0,0 +1,153 @@ +Various fixes for the configure script for C99 compatibility. +Most of the changes are generic in nature, due to the old version +of autoconf used by upstream (2.12). + +diff --git a/configure b/configure +index db2672686719f7e1..c82ff072e4e1de5d 100755 +--- a/configure ++++ b/configure +@@ -1008,7 +1008,7 @@ cross_compiling=$ac_cv_prog_cc_cross + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes +@@ -1489,8 +1489,8 @@ else + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int main () { int i; for (i = 0; i < 256; i++) +-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +-exit (0); } ++if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; ++return 0; } + + EOF + if { (eval echo configure:1497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +@@ -1645,7 +1645,7 @@ for ac_kw in inline __inline__ __inline; do + #include "confdefs.h" + + int main() { +-} $ac_kw foo() { ++} $ac_kw int foo() { + ; return 0; } + EOF + if { (eval echo configure:1652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +@@ -1917,8 +1917,8 @@ else + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int main () { int i; for (i = 0; i < 256; i++) +-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +-exit (0); } ++if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; ++return 0; } + + EOF + if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +@@ -2488,14 +2488,14 @@ else + #include "confdefs.h" + #include + /* If setvbuf has the reversed format, exit 0. */ +-main () { ++int main () { + /* This call has the arguments reversed. + A reversed system may check and see that the address of main + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) +- exit(1); ++ return 1; + putc('\r', stdout); +- exit(0); /* Non-reversed systems segv here. */ ++ return 0; /* Non-reversed systems segv here. */ + } + EOF + if { (eval echo configure:2502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +@@ -2694,12 +2694,15 @@ else + #include + #include + #include ++#include ++#include ++ ++#ifdef HAVE_UNISTD_H ++# include ++#endif + + /* This mess was copied from the GNU getpagesize.h. */ + #ifndef HAVE_GETPAGESIZE +-# ifdef HAVE_UNISTD_H +-# include +-# endif + + /* Assume that all systems that can run configure have sys/param.h. */ + # ifndef HAVE_SYS_PARAM_H +@@ -3032,9 +3035,9 @@ find_stack_direction () + else + return (&dummy > addr) ? 1 : -1; + } +-main () ++int main (void) + { +- exit (find_stack_direction() < 0); ++ return find_stack_direction() < 0; + } + EOF + if { (eval echo configure:3041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +@@ -3470,7 +3473,7 @@ else + #include + #include + #include +-main () ++int main (void) + { + struct timeb s, slast; + int c = 0; +@@ -3482,14 +3485,14 @@ main () + || (s.time == slast.time && s.millitm < slast.millitm)) { + fprintf(stderr,"s: %ld, %ld, slast: %ld, %ld\n", + s.time,s.millitm, slast.time,slast.millitm); +- exit (1); ++ return 1; + } + if (s.time != slast.time) + ++c; + slast.time = s.time; + slast.millitm = s.millitm; + } +- exit (0); ++ return 0; + } + + EOF +diff --git a/configure.in b/configure.in +index 429677e87e99a303..0fbe252a717afb59 100644 +--- a/configure.in ++++ b/configure.in +@@ -180,7 +180,7 @@ AC_CACHE_VAL(lrzsz_cv_sys_ftime_ok, + #include + #include + #include +-main () ++int main (void) + { + struct timeb s, slast; + int c = 0; +@@ -192,14 +192,14 @@ main () + || (s.time == slast.time && s.millitm < slast.millitm)) { + fprintf(stderr,"s: %ld, %ld, slast: %ld, %ld\n", + s.time,s.millitm, slast.time,slast.millitm); +- exit (1); ++ return 1; + } + if (s.time != slast.time) + ++c; + slast.time = s.time; + slast.millitm = s.millitm; + } +- exit (0); ++ return 0; + } + ], + lrzsz_cv_sys_ftime_ok=yes, diff --git a/lrzsz.spec b/lrzsz.spec index 7bae0b6..d08a570 100644 --- a/lrzsz.spec +++ b/lrzsz.spec @@ -1,13 +1,15 @@ Summary: The lrz and lsz modem communications programs Name: lrzsz Version: 0.12.20 -Release: 57%{?dist} +Release: 58%{?dist} License: GPLv2+ Source: http://www.ohse.de/uwe/releases/%{name}-%{version}.tar.gz Patch1: lrzsz-0.12.20-glibc21.patch Patch2: lrzsz-0.12.20.patch Patch3: lrzsz-0.12.20-man.patch Patch4: lrzsz-0.12.20-aarch64.patch +Patch5: lrzsz-configure-c99.patch +Patch6: lrzsz-c99.patch Url: http://www.ohse.de/uwe/software/lrzsz.html BuildRequires: gcc gettext BuildRequires: make @@ -25,6 +27,8 @@ copylefted Zmodem solution for Linux systems. %patch2 -p1 -b .crc %patch3 -p1 -b .man %patch4 -p1 -b .aarch64 +%patch5 -p1 +%patch6 -p1 rm -f po/*.gmo @@ -49,6 +53,9 @@ for m in sb sx; do ln -s sz.1 %{buildroot}%{_mandir}/man1/$m.1; done %{_mandir}/*/* %changelog +* Fri Jan 27 2023 Florian Weimer - 0.12.20-58 +- Fix C99 compatibility issues (#2164996) + * Thu Jan 19 2023 Fedora Release Engineering - 0.12.20-57 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild