This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
- From: Florian Weimer <fweimer at redhat dot com>
- To: Alexandra Hájková <alexandra dot khirnova at gmail dot com>
- Cc: libc-alpha at sourceware dot org, Alexandra Hájková <ahajkova at redhat dot com>
- Date: Mon, 05 Aug 2019 11:51:57 +0200
- Subject: Re: [PATCH v2] elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
- References: <20190801155914.13528-1-ahajkova@redhat.com>
* Alexandra Hájková:
> From: Alexandra Hájková <ahajkova@redhat.com>
>
> ---
> elf/tst-ldconfig-bad-aux-cache.c | 71 ++++++++++++++------------------
> 1 file changed, 31 insertions(+), 40 deletions(-)
>
> diff --git a/elf/tst-ldconfig-bad-aux-cache.c b/elf/tst-ldconfig-bad-aux-cache.c
> index 68ce90a956..0c4d9830ea 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,13 @@ display_info (const char *fpath, const struct stat *sb,
> return 0;
> }
>
> +static void
> +execv_wrapper(void *args)
Missing space before (.
> +{
> + execv (((char **)args)[0], (char **)args);
> + FAIL_EXIT1 ("execv: %m");
> +}
I would add a space after the (char **) cast, or you could use:
char **argv = args;
execv (argv[0], argv);
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (execv_wrapper, args);
> + support_capture_subprocess_check (&result, "execv", 0, sc_allow_none);
Sorry, I think a call to support_capture_subprocess_free is missing
after the check call.
> + /* Verify that ldconfig can run with a truncated
> + aux-cache and doesn't crash. */
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (execv_wrapper, args);
> + support_capture_subprocess_check (&result, "execv", 0, sc_allow_none);
And here as well.
Thanks,
Florian