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