From: Florian Weimer <fweimer@redhat.com>
To: Arjun Shankar <arjun.is@lostca.se>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose
Date: Mon, 11 Nov 2019 16:15:17 +0100 [thread overview]
Message-ID: <87eeyewika.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <20191111144052.GB5229@aloka.lostca.se> (Arjun Shankar's message of "Mon, 11 Nov 2019 14:40:53 +0000")
* Arjun Shankar:
> diff --git a/libio/tst-fopenloc.c b/libio/tst-fopenloc.c
> index e9548c57ac..797540da04 100644
> --- a/libio/tst-fopenloc.c
> +++ b/libio/tst-fopenloc.c
> @@ -25,14 +25,11 @@
> #include <string.h>
> #include <wchar.h>
> #include <sys/resource.h>
> +#include <support/support.h>
> +#include <support/xstdio.h>
>
> static const char inputfile[] = "../iconvdata/testdata/ISO-8859-1";
>
> -static int do_test(void);
> -
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
> -
> static int
> do_bz17916 (void)
> {
> @@ -66,14 +63,9 @@ do_test (void)
>
> mtrace ();
>
> - setlocale (LC_ALL, "de_DE.UTF-8");
> + xsetlocale (LC_ALL, "de_DE.UTF-8");
>
> - fp = fopen (inputfile, "r,ccs=ISO-8859-1");
> - if (fp == NULL)
> - {
> - printf ("cannot open \"%s\": %s\n", inputfile, strerror (errno));
> - exit (1);
> - }
> + fp = xfopen (inputfile, "r,ccs=ISO-8859-1");
>
> while (! feof_unlocked (fp))
> {
> @@ -85,7 +77,9 @@ do_test (void)
> fputws (buf, stdout);
> }
>
> - fclose (fp);
> + xfclose (fp);
>
> return do_bz17916 ();
> }
> +
> +#include <support/test-driver.c>
This patch looks good to me.
(Lack of error checking in setlocale can lead to weird test failures.)
Thanks,
Florian
prev parent reply other threads:[~2019-11-11 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 14:40 [PATCH] libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose Arjun Shankar
2019-11-11 15:15 ` Florian Weimer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eeyewika.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=arjun.is@lostca.se \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).