This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
- From: Dan Horák <dan at danny dot cz>
- To: libc-alpha at sourceware dot org
- Date: Mon, 5 Aug 2019 12:27:42 +0200
- Subject: Re: [PATCH v3] elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
- References: <20190805101519.11739-1-ahajkova@redhat.com>
On Mon, 5 Aug 2019 12:15:19 +0200
Alexandra Hájková <alexandra.khirnova@gmail.com> wrote:
> From: Alexandra Hájková <ahajkova@redhat.com>
>
> ---
> elf/tst-ldconfig-bad-aux-cache.c | 75 ++++++++++++++
> +----------------- 1 file changed, 35 insertions(+), 40 deletions(-)
>
> diff --git a/elf/tst-ldconfig-bad-aux-cache.c
> b/elf/tst-ldconfig-bad-aux-cache.c index 68ce90a956..a7afcf4e94 100644
> --- a/elf/tst-ldconfig-bad-aux-cache.c
> +++ b/elf/tst-ldconfig-bad-aux-cache.c
> @@ -31,6 +31,7 @@
> #include <ftw.h>
> #include <stdint.h>
>
> +#include <support/capture_subprocess.h>
> #include <support/check.h>
> #include <support/support.h>
> #include <support/xunistd.h>
> @@ -52,6 +53,15 @@ display_info (const char *fpath, const struct stat
> *sb, return 0;
> }
>
> +static void
> +execv_wrapper (void *args)
> +{
> + char **argv = args;
> +
> + execv (argv[0], argv);
> + FAIL_EXIT1 ("execv: %m");
> +}
> +
> /* Run ldconfig with a corrupt aux-cache, in particular we test for
> size truncation that might happen if a previous ldconfig run failed
> or if there were storage or power issues while we were writing the
> file. @@ -61,54 +71,39 @@ static int
> do_test (void)
> {
> char *prog = xasprintf ("%s/ldconfig",
> support_install_rootsbindir);
> - char *const args[] = { prog, NULL };
> + char *args[] = { prog, NULL };
> const char *path = "/var/cache/ldconfig/aux-cache";
> struct stat64 fs;
> long int size, new_size, i;
> - int status;
> - pid_t pid;
>
> /* Create the needed directories. */
> xmkdirp ("/var/cache/ldconfig", 0777);
>
> - pid = xfork ();
> /* Run ldconfig fist to generate the aux-cache. */
^^^ s/fist/first/
> - if (pid == 0)
> - {
> - execv (args[0], args);
> - _exit (1);
> - }
Dan