]> 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>
Mon, 12 Apr 2021 13:33:19 +0000 (19:03 +0530)
commit716a3bdc41b2b4b864dc64475015ba51e35e1273
tree103a573114c8263cec174ca7fd655ff4612f0ee9
parent8d4d77f6c848538cfb9e5ad0a14825e7ae4a1657
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>
stdlib/tst-secure-getenv.c
support/capture_subprocess.h
support/subprocess.h
support/support_capture_subprocess.c
support/support_subprocess.c