From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id 5141D3814FFE for ; Tue, 7 Jun 2022 14:40:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5141D3814FFE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1654612819; x=1686148819; h=from:to:cc:in-reply-to:subject:mime-version: content-transfer-encoding:references:message-id:date; bh=qMIETqtOobkqw9QBWUQF/7hqytbHDGuneO/l74SjP98=; b=ln8arUtYDkGpRSOohr6bOo3YyO2RXEJzRVpaonhazJckfvEZeXXNo8h0 Mp3g5oMUgVz3o9nZ/uFuHspO1fkHuQU0IicFpJVLX+9vTMnTHsNQN0ppw fG8vGfwz4tsH8nQ7omvscolhWHQwQTN5hfPYxV2LJn58iiGgVAGxWkKwR 0MrbMO/pjXuDXlNhj9da4pOM92/MdM6h/aqaSyTt0Dr+R7DJ51AB3D1dm tvlPRfHocqZNBypEPlZAyIlQvSFH1WI1FF+wt17faG4Jb3Zq2EdtaDY7s Su6tRKQtUPoxt/lMwYWJPwD+/6saN2ULocvazouph4Mfl0QVC/POhPG0a w==; From: Hans-Peter Nilsson To: Torbjorn SVENSSON CC: In-Reply-To: (message from Torbjorn SVENSSON on Tue, 7 Jun 2022 08:05:01 +0200) Subject: Re: [PATCH] Fix stdio init handling MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20220606182003.DB8A72041A@pchp3.se.axis.com> Message-ID: <20220607144017.E678620419@pchp3.se.axis.com> Date: Tue, 7 Jun 2022 16:40:17 +0200 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2022 14:40:21 -0000 > From: Torbjorn SVENSSON > Date: Tue, 7 Jun 2022 08:05:01 +0200 > > FILE *f = fopen("fff", "r"); > > int c = fgetc(f); > > > > if (f == NULL) > > { > > perror("fopen"); > > abort(); > > } > > > > Unrelated to the patch proposed, but I think you should > avoid calling fgetc(f) prior to checking if f is NULL or a > valid pointer. > > Kind regards, > Torbjörn You're absolutely right, and I am fully aware. I'll clarify: this was only intended was a quick reproducer of the problem, not a model program. brgds, H-P