[PATCH v2] Add LFS support for fts functions [BZ #11460]
Dmitry V. Levin
ldv@altlinux.org
Tue Oct 13 02:12:00 GMT 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151013/248d3edc/attachment.sig>
More information about the Libc-alpha
mailing list