This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v5] elf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]


* Alexandra Hájková:

> +static int
> +display_info (const char *fpath, const struct stat *sb,
> +              int tflag, struct FTW *ftwbuf)
> +{
> +  printf ("%-3s %2d %7jd   %-40s %d %s\n",
> +          (tflag == FTW_D) ? "d" : (tflag == FTW_DNR) ? "dnr" :
> +          (tflag == FTW_DP) ? "dp" : (tflag == FTW_F) ? "f" :
> +          (tflag == FTW_NS) ? "ns" : (tflag == FTW_SL) ? "sl" :
> +          (tflag == FTW_SLN) ? "sln" : "???",
> +          ftwbuf->level, (intmax_t) sb->st_size,
> +          fpath, ftwbuf->base, fpath + ftwbuf->base);
> +  /* To tell nftw to continue.  */
> +  return 0;
> +}

Maybe add an info: prefix to the line, to indicate that this output does
not reflect an error condition?

> +      xwaitpid (pid, &status, 0);
> +      if (!(WIFEXITED (status)))
> +        FAIL_EXIT1 ("ldconfig was aborted");
> +      xstat (path, &fs);

> +              xwaitpid (pid, &status, 0);
> +              if (!(WIFEXITED (status)))
> +                FAIL_EXIT1 ("ldconfig exited with non-zero status");

I think we really expect exit status 0 in this case, so you could use
TEST_COMPARE (status, 0) in both cases.

> +          if (truncate (path, new_size))
> +            {
> +                FAIL_EXIT1 ("truncation failed: %m");
> +            }
> +          if (nftw (path, display_info, 1000, 0) == -1)
> +            {
> +              FAIL_EXIT1 ("nftw failed.");
> +            }

Here the braces are unnecessary.

Sorry for the piece-by-piece review, but we are definitely getting
close!

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]