[PATCH] Delete temporary files in support_subprocess and tst-fopen-threaded.c

Florian Weimer fweimer@redhat.com
Sat Jul 19 13:01:25 GMT 2025


* H. J. Lu:

> 1. Call support_delete_temp_files to delete temporary files before exit in
> support_subprocess.
> 2. Change tst-fopen-threaded.c to call support_create_temp_directory to
> create a temporary directory and open "file" in the temporary directory,
> instead of using /tmp/openclosetest.
>
> This partially fixes BZ #33182.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  support/support_subprocess.c         |  3 +++
>  sysdeps/pthread/tst-fopen-threaded.c | 14 ++++++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/support/support_subprocess.c b/support/support_subprocess.c
> index be00dde3a7..8bf9a33ea2 100644
> --- a/support/support_subprocess.c
> +++ b/support/support_subprocess.c
> @@ -25,6 +25,7 @@
>  #include <support/check.h>
>  #include <support/xunistd.h>
>  #include <support/subprocess.h>
> +#include <support/temp_file-internal.h>
>  
>  static struct support_subprocess
>  support_subprocess_init (void)
> @@ -60,6 +61,8 @@ support_subprocess (void (*callback) (void *), void *closure)
>        xclose (result.stdout_pipe[1]);
>        xclose (result.stderr_pipe[1]);
>        callback (closure);
> +      /* Make sure that temporary files are deleted.  */
> +      support_delete_temp_files ();
>        _exit (0);
>      }
>    xclose (result.stdout_pipe[1]);

I think the change is okay because there is a PID check in
support_delete_temp_files.  But I haven't run the full test suite.

Since this is a framework change, this should go in separately in case
wee want to backport it without the test change.

Thanks,
Florian



More information about the Libc-alpha mailing list