From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id ED9CD396DC20 for ; Thu, 30 Apr 2020 20:30:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ED9CD396DC20 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-mUYtUzw1PVKURrRBeHV1nw-1; Thu, 30 Apr 2020 16:30:09 -0400 X-MC-Unique: mUYtUzw1PVKURrRBeHV1nw-1 Received: by mail-qk1-f200.google.com with SMTP id 30so7683147qkp.21 for ; Thu, 30 Apr 2020 13:30:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=9nPJYBhEWaF3T38izXqoRmI3X773VNgP5v7Y6l+ck2U=; b=aZoFg8w0eX7vDhuvBMOXPy8XGShYmEWx8/rjvkBc8F76nUNx/aI5zuEbuHGZbxnXcO XS1yLnK7PY4yOFlaSgnNu2H4BHOTTYZ4d6qiRMAd5LcgRQMcey5RUIwG8HCRDAVp4RuA 7da/YAksd6jOpd4EKnX86sE8E5Mdcg2AAC38khN/I0Oq6z2s4kwH7QGikhwyK/oOAVhB tgDIOTbewVTJjGvMWf4S3/OZklX67n27oIzJkCcAfjmxzyltsHQlk5pEzEOcuQNQwnHz ZHiDlBLKS1UaC1alaRJB3vF9juH7X5geNBrSYwoyuCfC1lJzSstkbxyCp2QhQJ6BHo6G Xf1A== X-Gm-Message-State: AGi0PuZh04sicCXMhQGI3cxb0fZdEg38seZf3XSgvJE7stOkEg+nkUiO NoR+0qrwEOj7S/DU8UvBBhyABicb3t6aVYadoI1AT6bJcglCNEogzzytEU7dzH4Roy5On47Ba+Z H32zMoA10FzPAxYyFfnZf X-Received: by 2002:a05:620a:214f:: with SMTP id m15mr309704qkm.336.1588278608305; Thu, 30 Apr 2020 13:30:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJvmrVh/EuHA4hLSXJaSsBFTAnSZrD+hdQjPXBgOzmMWjqeLTkgiAog1AtbFEg4K1SRxFKYSQ== X-Received: by 2002:a05:620a:214f:: with SMTP id m15mr309685qkm.336.1588278608115; Thu, 30 Apr 2020 13:30:08 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id b3sm660844qtp.12.2020.04.30.13.30.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 13:30:07 -0700 (PDT) Subject: Re: [PATCH] support: Set errno before testing it. To: DJ Delorie Cc: libc-alpha@sourceware.org References: From: Carlos O'Donell Organization: Red Hat Message-ID: <8195cc6c-c1ef-214d-6e17-10aac1b4eb60@redhat.com> Date: Thu, 30 Apr 2020 16:30:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-22.1 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: Thu, 30 Apr 2020 20:30:12 -0000 On 4/29/20 6:54 PM, DJ Delorie wrote: > "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/ Fixed. Pushed as #3 in sequence. >> 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) >> else if (nt == 3 && strcmp (the_words[0], "chmod") == 0) >> { >> long int m; >> + errno = 0; >> m = strtol (the_words[1], NULL, 0); >> + TEST_COMPARE (errno, 0); >> if (chmod (the_words[2], m) < 0) > > Ok. > >> parse_int (const char *str) >> { >> char *endptr; >> - long int ret = strtol (str, &endptr, 10); >> + long int ret; >> + errno = 0; >> + ret = strtol (str, &endptr, 10); >> TEST_COMPARE (errno, 0); > > Ok. > -- Cheers, Carlos.