From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id D03B9385DC0A for ; Wed, 29 Apr 2020 22:55:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D03B9385DC0A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-Aq9wg-DwNfmV-FRnu2sxfw-1; Wed, 29 Apr 2020 18:55:00 -0400 X-MC-Unique: Aq9wg-DwNfmV-FRnu2sxfw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C69245F for ; Wed, 29 Apr 2020 22:54:59 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-52.phx2.redhat.com [10.3.112.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F5276606A; Wed, 29 Apr 2020 22:54:56 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.14.7/8.14.7) with ESMTP id 03TMstZq018137; Wed, 29 Apr 2020 18:54:55 -0400 From: DJ Delorie To: "Carlos O'Donell" Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] support: Set errno before testing it. In-Reply-To: <970ad4c1-2666-3a54-c591-e52b8014bd40@redhat.com> (carlos@redhat.com) Date: Wed, 29 Apr 2020 18:54:55 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 22:55:06 -0000 "Carlos O'Donell" writes: > OK for master? LGTM with one typo Reviewed-by: DJ Delorie > In test-conainer we should set errno to 0 before calling chmod, > and check after with TEST_COMPARE. s/chmod/strtol/ > diff --git a/support/test-container.c b/support/test-container.c > index 08d5195b7e..afc23db148 100644 > --- a/support/test-container.c > +++ b/support/test-container.c > @@ -940,7 +940,9 @@ main (int argc, char **argv) > =09 else if (nt =3D=3D 3 && strcmp (the_words[0], "chmod") =3D=3D 0) > =09 { > =09=09long int m; > +=09=09errno =3D 0; > =09=09m =3D strtol (the_words[1], NULL, 0); > +=09=09TEST_COMPARE (errno, 0); > =09=09if (chmod (the_words[2], m) < 0) Ok. > parse_int (const char *str) > { > char *endptr; > - long int ret =3D strtol (str, &endptr, 10); > + long int ret; > + errno =3D 0; > + ret =3D strtol (str, &endptr, 10); > TEST_COMPARE (errno, 0); Ok.