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: Andreas Schwab <schwab at suse dot de>
- 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 12:50:52 +0200
- Subject: Re: [PATCH v3] elf: tst-ldconfig-bad-aux-cache: use support_capture_subprocess
- References: <20190805101519.11739-1-ahajkova@redhat.com>
On Aug 05 2019, Alexandra Hájková <alexandra.khirnova@gmail.com> wrote:
> @@ -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");
> +}
Indent with two spaces.
> + struct support_capture_subprocess result;
> + result = support_capture_subprocess (execv_wrapper, args);
> + support_capture_subprocess_check (&result, "execv", 0, sc_allow_none);
> + support_capture_subprocess_free (&result);
> +
> + xstat (path, &fs);
> +
> + size = fs.st_size;
> + /* Run 3 tests, each truncating aux-cache shorter and shorter. */
> + for (i = 3; i > 0; i--)
> + {
> + new_size = size * i / 4;
> + if (truncate (path, new_size))
> + FAIL_EXIT1 ("truncation failed: %m");
> + if (nftw (path, display_info, 1000, 0) == -1)
> + FAIL_EXIT1 ("nftw failed.");
> +
> + /* 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);
> + support_capture_subprocess_free (&result);
> + }
Likewise.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."