Avoiding "write error" messages when piping to grep (#976199)
This commit is contained in:
parent
c0b21bcd1d
commit
2fda39079b
@ -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.7
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv2+ and LGPLv2+
|
||||
Group: Applications/System
|
||||
URL: https://sourceforge.net/projects/procps-ng/
|
||||
@ -13,6 +13,7 @@ Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
|
||||
|
||||
Patch0: procps-ng-3.3.7-testsuite-reverting-bogus-commit-unix-exp.patch
|
||||
Patch1: procps-ng-3.3.7-segv-file2str-read-zero-bytes.patch
|
||||
Patch2: 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
|
||||
|
||||
Requires(post): /sbin/ldconfig
|
||||
Requires(postun): /sbin/ldconfig
|
||||
@ -70,6 +71,7 @@ System and process monitoring utilities development headers
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
# The following stuff is needed for git archives only
|
||||
@ -134,6 +136,9 @@ mkdir -p %{buildroot}%{_sysconfdir}/sysctl.d
|
||||
%{_includedir}/proc
|
||||
|
||||
%changelog
|
||||
* Wed Jun 26 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.7-6
|
||||
- Avoiding "write error" messages when piping to grep (#976199)
|
||||
|
||||
* Tue Jun 25 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.7-5
|
||||
- Enabling UTF-8 in watch
|
||||
- Disabling tests - unsuitable for running on buildsystems
|
||||
|
Loading…
Reference in New Issue
Block a user