mirror of git://sourceware.org/git/glibc.git
tst-env-setuid: Delete LD_DEBUG_OUTPUT output
Update tst-env-setuid.c to delete LD_DEBUG_OUTPUT output, instead of leaving it behind. This partially fixes BZ #33182. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
6463d4a7b2
commit
5d23dfb289
|
|
@ -40,6 +40,8 @@ static char SETGID_CHILD[] = "setgid-child";
|
|||
# define PROFILE_LIB "tst-sonamemove-runmod2.so"
|
||||
#endif
|
||||
|
||||
#define LD_DEBUG_OUTPUT "/tmp/some-file"
|
||||
|
||||
struct envvar_t
|
||||
{
|
||||
const char *env;
|
||||
|
|
@ -61,7 +63,7 @@ static const struct envvar_t filtered_envvars[] =
|
|||
{ "MALLOC_TRIM_THRESHOLD_", FILTERED_VALUE },
|
||||
{ "RES_OPTIONS", FILTERED_VALUE },
|
||||
{ "LD_DEBUG", "all" },
|
||||
{ "LD_DEBUG_OUTPUT", "/tmp/some-file" },
|
||||
{ "LD_DEBUG_OUTPUT", LD_DEBUG_OUTPUT },
|
||||
{ "LD_WARN", FILTERED_VALUE },
|
||||
{ "LD_VERBOSE", FILTERED_VALUE },
|
||||
{ "LD_BIND_NOW", "0" },
|
||||
|
|
@ -74,6 +76,14 @@ static const struct envvar_t unfiltered_envvars[] =
|
|||
{ "LD_ASSUME_KERNEL", UNFILTERED_VALUE },
|
||||
};
|
||||
|
||||
static void
|
||||
unlink_ld_debug_output (pid_t pid)
|
||||
{
|
||||
char *output = xasprintf ("%s.%d", LD_DEBUG_OUTPUT, pid);
|
||||
unlink (output);
|
||||
free (output);
|
||||
}
|
||||
|
||||
static int
|
||||
test_child (void)
|
||||
{
|
||||
|
|
@ -138,13 +148,21 @@ do_test (int argc, char **argv)
|
|||
/* Setgid child process. */
|
||||
if (argc == 2 && strcmp (argv[1], SETGID_CHILD) == 0)
|
||||
{
|
||||
pid_t ppid = getppid ();
|
||||
|
||||
if (getgid () == getegid ())
|
||||
/* This can happen if the file system is mounted nosuid. */
|
||||
FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n",
|
||||
(intmax_t) getgid ());
|
||||
{
|
||||
/* This can happen if the file system is mounted nosuid. */
|
||||
unlink_ld_debug_output (ppid);
|
||||
|
||||
FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n",
|
||||
(intmax_t) getgid ());
|
||||
}
|
||||
|
||||
int ret = test_child ();
|
||||
|
||||
unlink_ld_debug_output (ppid);
|
||||
|
||||
if (ret != 0)
|
||||
exit (1);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue