This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/24693] New: support/support_subprocess.c (support_suprocess_init): Should set result.pid and be named differently
- From: "carlos at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 17 Jun 2019 16:44:13 +0000
- Subject: [Bug libc/24693] New: support/support_subprocess.c (support_suprocess_init): Should set result.pid and be named differently
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=24693
Bug ID: 24693
Summary: support/support_subprocess.c (support_suprocess_init):
Should set result.pid and be named differently
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: carlos at redhat dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
The function support_suprocess_init should be named support_subprocess_init
(note the missing 'b') and it should set result.pid to -1 or some other
nonsense value. We may want to detect the unset pid, though today we almost
always set it to a new value that we fork or spawn.
e.g.
diff --git a/support/support_subprocess.c b/support/support_subprocess.c
index 0c8cc6af30..84c84c48f4 100644
--- a/support/support_subprocess.c
+++ b/support/support_subprocess.c
@@ -27,10 +27,12 @@
#include <support/subprocess.h>
static struct support_subprocess
-support_suprocess_init (void)
+support_subprocess_init (void)
{
struct support_subprocess result;
+ result.pid = -1;
+
xpipe (result.stdout_pipe);
TEST_VERIFY (result.stdout_pipe[0] > STDERR_FILENO);
TEST_VERIFY (result.stdout_pipe[1] > STDERR_FILENO);
@@ -48,7 +50,7 @@ support_suprocess_init (void)
struct support_subprocess
support_subprocess (void (*callback) (void *), void *closure)
{
- struct support_subprocess result = support_suprocess_init ();
+ struct support_subprocess result = support_subprocess_init ();
result.pid = xfork ();
if (result.pid == 0)
@@ -71,7 +73,7 @@ support_subprocess (void (*callback) (void *), void *closure)
struct support_subprocess
support_subprogram (const char *file, char *const argv[])
{
- struct support_subprocess result = support_suprocess_init ();
+ struct support_subprocess result = support_subprocess_init ();
posix_spawn_file_actions_t fa;
/* posix_spawn_file_actions_init does not fail. */
---
Untested.
--
You are receiving this mail because:
You are on the CC list for the bug.