Avoiding "write error" messages when piping to grep (#976199)
This commit is contained in:
parent
52c414fead
commit
0b0fe25a60
@ -0,0 +1,42 @@
|
||||
From b1f06bdcc9e02f7dbaf1161ad6231c45ea3f9d88 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Tue, 25 Jun 2013 00:00:00 -0500
|
||||
Subject: [PATCH 2/2] library: for atexit() support, fix fileutils for EPIPE
|
||||
|
||||
When fileutils with stream error checking was borrowed
|
||||
from GNU lib, an omission was also propagated where an
|
||||
errno of EPIPE wouldn't be preserved in close_stream()
|
||||
making a test for EPIPE in close_stdout() meaningless.
|
||||
|
||||
This patch corrects such oversight so that an errno of
|
||||
EPIPE no longer produces 'write error' at program end.
|
||||
|
||||
( gnulib provides for optionally ignoring EPIPE, but )
|
||||
( if a program chooses to ignore it, then their code )
|
||||
( appears to suffer from this close_stream oversight )
|
||||
|
||||
Reference(s):
|
||||
. original fileutilis addition
|
||||
commit c7cf98b0e03780f78abe5275c6fb282f71a2369f
|
||||
. bugzilla report
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=976199
|
||||
---
|
||||
lib/fileutils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/fileutils.c b/lib/fileutils.c
|
||||
index a9ef2ff..1ade3d8 100644
|
||||
--- a/lib/fileutils.c
|
||||
+++ b/lib/fileutils.c
|
||||
@@ -24,7 +24,7 @@ int close_stream(FILE * stream)
|
||||
const int prev_fail = (ferror(stream) != 0);
|
||||
const int fclose_fail = (fclose(stream) != 0);
|
||||
if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) {
|
||||
- if (!fclose_fail)
|
||||
+ if (!fclose_fail && errno != EPIPE)
|
||||
errno = 0;
|
||||
return EOF;
|
||||
}
|
||||
--
|
||||
1.8.1.2
|
||||
|
@ -4,7 +4,7 @@
|
||||
Summary: System and process monitoring utilities
|
||||
Name: procps-ng
|
||||
Version: 3.3.8
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv2+ and LGPLv2+
|
||||
Group: Applications/System
|
||||
URL: https://sourceforge.net/projects/procps-ng/
|
||||
@ -12,6 +12,7 @@ URL: https://sourceforge.net/projects/procps-ng/
|
||||
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
|
||||
|
||||
Patch0: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch
|
||||
Patch1: 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
|
||||
|
||||
Requires(post): /sbin/ldconfig
|
||||
Requires(postun): /sbin/ldconfig
|
||||
@ -68,6 +69,7 @@ System and process monitoring utilities development headers
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
# The following stuff is needed for git archives only
|
||||
@ -132,6 +134,9 @@ mkdir -p %{buildroot}%{_sysconfdir}/sysctl.d
|
||||
%{_includedir}/proc
|
||||
|
||||
%changelog
|
||||
* Wed Jun 26 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.8-6
|
||||
- Avoiding "write error" messages when piping to grep (#976199)
|
||||
|
||||
* Wed Jun 26 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.8-5
|
||||
- Disabling tests - unsuitable for running on buildsystems
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user