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] | |
On Mon, Oct 12, 2015 at 09:52:58PM +0200, Mark Wielaard wrote:
[...]
> diff --git a/io/tst-fts.c b/io/tst-fts.c
> new file mode 100644
> index 0000000..92a2674
> --- /dev/null
> +++ b/io/tst-fts.c
First of all, thanks for adding the first test of fts API.
[...]
> +static void
> +make_dir (const char *dirname)
> +{
> + char *name = NULL;
This initialization is redundant.
> + if (asprintf (&name, "%s/%s", fts_test_dir, dirname) < 0)
> + {
> + puts ("out of memory");
> + exit (1);
> + }
> +
> + if (mkdir (name, 0777) < 0)
> + {
> + printf ("cannot create dir \"%s\": %s\n", name, strerror (errno));
Let's use %m instead of %s with strerror(errno).
> + exit (1);
> + }
> +
> + add_temp_file (name);
> +}
> +
> +static void
> +make_file (const char *filename)
> +{
> + char *name = NULL;
> + if (asprintf (&name, "%s/%s", fts_test_dir, filename) < 0)
> + {
> + puts ("out of memory");
> + exit (1);
> + }
> +
> + int fd = open (name, O_WRONLY | O_CREAT | O_EXCL, 0600);
The modes specified for mkdir and open are somewhat inconsistent.
My personal preference for tmp files/dirs would be 0600/0700.
[...]
> +static void
> +children (FTS *fts)
> +{
> + FTSENT *child = fts_children (fts, 0);
> + if (child == NULL && errno != 0)
> + error (1, errno, "fts_children");
In glibc tests, error diagnostics of this kind should go to stdout
so that it could be captured in the .out file.
--
ldv
Attachment:
pgpXlnhEW_ef7.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |