]> git.ipfire.org Git - thirdparty/glibc.git/commit
support: Add capability to fork an sgid child
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 9 Apr 2021 15:25:45 +0000 (20:55 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Wed, 14 Apr 2021 04:59:52 +0000 (10:29 +0530)
commit267e174f198532d950a6f419681689d73b2c633c
tree1db0e8d5834c498a20db55a27c8604e251d12768
parent249c486ce8e80a9e94d51b4bbf3ccf5d0af57e5e
support: Add capability to fork an sgid child

Add a new function support_capture_subprogram_self_sgid that spawns an
sgid child of the running program with its own image and returns the
exit code of the child process.  This functionality is used by at
least three tests in the testsuite at the moment, so it makes sense to
consolidate.

There is also a new function support_subprogram_wait which should
provide simple system() like functionality that does not set up file
actions.  This is useful in cases where only the return code of the
spawned subprocess is interesting.

This patch also ports tst-secure-getenv to this new function.  A
subsequent patch will port other tests.  This also brings an important
change to tst-secure-getenv behaviour.  Now instead of succeeding, the
test fails as UNSUPPORTED if it is unable to spawn a setgid child,
which is how it should have been in the first place.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 716a3bdc41b2b4b864dc64475015ba51e35e1273)
stdlib/tst-secure-getenv.c
support/capture_subprocess.h
support/subprocess.h
support/support_capture_subprocess.c
support/support_subprocess.c