Avoid spurious errors by re-setting errno to 0 before calling that readdir()

Resolves: rhbz#1204139
- Add a patch to support compiling on Linux 4.*
This commit is contained in:
Jaroslav Škarvada 2015-05-04 15:44:35 +02:00
parent e67f023b81
commit 9ad976611e
3 changed files with 56 additions and 3 deletions

View File

@ -0,0 +1,19 @@
This patch allows the postfix build system to accept building on Linux 4.*
Even for Linux 4.x systems, it sets SYSTYPE variable to Linux3 because
I am not sure if I'd have to change other part of the build system to
make it cope with the new Linux 4.x. I guess I'll try in subsequent
patch to set the SYSTYPE properly and see what breaks. For now, this
seems to work.
--- postfix-3.0.1/makedefs 2015-04-26 19:07:31.924108509 +0200
+++ postfix-3.0.1/makedefs.dodji 2015-04-26 19:06:22.678638335 +0200
@@ -500,7 +500,7 @@
: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
: ${PLUGIN_LD="${CC-gcc} -shared"}
;;
- Linux.3*) SYSTYPE=LINUX3
+ Linux.3*|Linux.4*) SYSTYPE=LINUX3
case "$CCARGS" in
*-DNO_DB*) ;;
*-DHAS_DB*) ;;

View File

@ -0,0 +1,22 @@
This patch comes from Mika Ilmaranta who attched it to the bug
https://bugzilla.redhat.com/show_bug.cgi?id=1204139.
--- postfix-3.0.1/src/util/scan_dir.c 2015-04-21 20:44:19.985338673 +0300
+++ postfix-3.0.1/src/util/scan_dir.c.reset-errno-before-readdir 2015-04-21 20:47:32.791855824 +0300
@@ -78,6 +78,7 @@
#endif
#endif
#include <string.h>
+#include <errno.h>
/* Utility library. */
@@ -177,6 +178,8 @@ char *scan_dir_next(SCAN_DIR *scan)
#define STREQ(x,y) (strcmp((x),(y)) == 0)
if (info) {
+ /* Some implementations report spurious errors. */
+ errno = 0;
while ((dp = readdir(info->dir)) != 0) {
if (STREQ(dp->d_name, ".") || STREQ(dp->d_name, "..")) {
if (msg_verbose > 1)

View File

@ -42,7 +42,7 @@
Name: postfix
Summary: Postfix Mail Transport Agent
Version: 3.0.1
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 2
Group: System Environment/Daemons
URL: http://www.postfix.org
@ -84,7 +84,12 @@ Source101: postfix-pam.conf
Patch1: postfix-3.0.0-config.patch
Patch2: postfix-3.0.0-files.patch
Patch3: postfix-3.0.0-alternatives.patch
Patch8: postfix-3.0.0-large-fs.patch
Patch4: postfix-3.0.0-large-fs.patch
# The patch below make the package compile on Linux 4.xx
Patch5: postfix-3.0.1-linux4.patch
# The patch below resets the global errno variable to 0 before calling
# readdir(). This seems to fix bug rhbz#1204139
Patch6: postfix-3.0.1-reset-errno-before-readdir.patch
Patch9: pflogsumm-1.1.3-datecalc.patch
# Optional patches - set the appropriate environment variables to include
@ -208,7 +213,9 @@ maps with Postfix, you need this.
%patch1 -p1 -b .config
%patch2 -p1 -b .files
%patch3 -p1 -b .alternatives
%patch8 -p1 -b .large-fs
%patch4 -p1 -b .large-fs
%patch5 -p1 -b .linux4
%patch6 -p1 -b .reset-errno-before-readdir
# Change DEF_SHLIB_DIR according to build host
sed -i \
@ -728,6 +735,11 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Sun Apr 26 2015 Dodji Seketeli <dodji@seketeli.org> - 2:3.0.1-2
- Avoid spurious errors by re-setting errno to 0 before calling that readdir()
Resolves: rhbz#1204139
- Add a patch to support compiling on Linux 4.*
* Mon Apr 13 2015 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.0.1-1
- New version