From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1876E1F454 for ; Mon, 11 Nov 2019 15:15:28 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=hzzB0pzHW2jgMvJ5TbKV+ftabOPhWYQ5/+f2WFC06yA i+79VKaboaPxyBH4maOxExs4EzhyyviTc5F8Y+ua8z76O4gp1bRCI/BbJPxFk8Rf Cv9Xija22i5qzYbnK6vg533nevaup1dXZDIqDhYWWCXtaVFibU911YcZGVnfBx3U = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=FrqQR00uNS0F8oQkDPp/7/5DIc0=; b=h6d0UbFNVmN3u1Ln9 62WrJuZ+qMIU4F5CpOF2z4YJl2iWPztdCaZwRNf4yHgShirMFWM2ct4mUs/R7y8B AzIFtan8BKX6vYnY3BaC4Rkb1xzRU0RPdeLiBHyHB/hHCo4AgYUVQX5OaN+CteuS 6hdBFx2FogjAZEw7nmQXrkvaZ0= Received: (qmail 13941 invoked by alias); 11 Nov 2019 15:15:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 13913 invoked by uid 89); 11 Nov 2019 15:15:24 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573485321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VGKooRW8ZYtxSsKsHgo79Be/ijaLqQRbSp9gPvzEhIs=; b=NaRf0y8Vna/9Bvk+05SGeeP+7C29+sOMrO5W8kFuDupJY34BnnlGCQ9VZajU0o8nOp1v1q cQARGhx/eVPkivvNolqLo7De+8FIUBfGlBUrZGnQSnPI9XcKJlGWDyCwboJ8RZFcDkIXsI 1xdMD8iybax8UFyJztGCQvkiVFqNiIc= From: Florian Weimer To: Arjun Shankar Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose References: <20191111144052.GB5229@aloka.lostca.se> Date: Mon, 11 Nov 2019 16:15:17 +0100 In-Reply-To: <20191111144052.GB5229@aloka.lostca.se> (Arjun Shankar's message of "Mon, 11 Nov 2019 14:40:53 +0000") Message-ID: <87eeyewika.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable * 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 > #include > #include > +#include > +#include > =20 > static const char inputfile[] =3D "../iconvdata/testdata/ISO-8859-1"; > =20 > -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) > =20 > mtrace (); > =20 > - setlocale (LC_ALL, "de_DE.UTF-8"); > + xsetlocale (LC_ALL, "de_DE.UTF-8"); > =20 > - fp =3D fopen (inputfile, "r,ccs=3DISO-8859-1"); > - if (fp =3D=3D NULL) > - { > - printf ("cannot open \"%s\": %s\n", inputfile, strerror (errno)); > - exit (1); > - } > + fp =3D xfopen (inputfile, "r,ccs=3DISO-8859-1"); > =20 > while (! feof_unlocked (fp)) > { > @@ -85,7 +77,9 @@ do_test (void) > fputws (buf, stdout); > } > =20 > - fclose (fp); > + xfclose (fp); > =20 > return do_bz17916 (); > } > + > +#include This patch looks good to me. (Lack of error checking in setlocale can lead to weird test failures.) Thanks, Florian