RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/time#71b1dd06b6211b4a7ae733b714ff0d5bf0b52dec
This commit is contained in:
Troy Dawson 2020-11-16 14:02:48 -08:00
parent 9befe89ae5
commit 762685cdfc
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 6a5c4499aab677d19157c7adcf598d14267283c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 16 Nov 2020 17:45:04 +0100
Subject: [PATCH] Close outfp before exec
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When called with --outfile, we open an output file to which
we log timing results. Close that descriptor in the child
fork before exec'ing the process to be timed.
Reported-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/time.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/time.c b/src/time.c
index f76265a..2f2b702 100644
--- a/src/time.c
+++ b/src/time.c
@@ -738,6 +738,8 @@ run_command (cmd, resp)
error (EXIT_CANCELED, errno, "cannot fork");
else if (pid == 0)
{ /* If child. */
+ if (outfp != stderr)
+ fclose(outfp);
/* Don't cast execvp arguments; that causes errors on some systems,
versus merely warnings if the cast is left off. */
execvp (cmd[0], cmd);
--
2.25.4

View File

@ -1,7 +1,7 @@
Summary: A GNU utility for monitoring a program's use of system resources
Name: time
Version: 1.9
Release: 10%{?dist}
Release: 12%{?dist}
# src/time.c: GPLv3+
# COPYING: GPLv3 text
# doc/time.texi: GFDL
@ -49,6 +49,10 @@ Patch1: time-1.9-Improve-info-directory-index-entry-description.patch
# Clarify RSS size as kibibytes in a documentation, proposed to an upstream,
# <https://lists.gnu.org/archive/html/bug-time/2020-07/msg00000.html>
Patch2: time-1.9-Use-kibibytes-instead-of-kilobytes-in-a-documentatio.patch
# Do not leak a file descriptor of the --output argument to a command,
# proposed to an upstream,
# <https://lists.gnu.org/archive/html/bug-time/2020-11/msg00001.html>
Patch3: time-1.9-Close-outfp-before-exec.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
@ -69,6 +73,7 @@ the results.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
autoreconf -fi
%build
@ -91,6 +96,13 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
# time(1) manual page lives in man-pages package, bug #1612294.
%changelog
* Mon Nov 16 2020 Petr Pisar <ppisar@redhat.com> - 1.9-12
- Fix a regression in closing a file descriptor if no --output was given
(bug #1898138)
* Wed Nov 11 2020 Petr Pisar <ppisar@redhat.com> - 1.9-11
- Do not leak a file descriptor of the --output argument to a command
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild