From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id EB35A3858D28 for ; Mon, 19 Dec 2022 15:16:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB35A3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id DE94430067C3; Mon, 19 Dec 2022 16:16:42 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id A737C413CD0E; Mon, 19 Dec 2022 16:16:42 +0100 (CET) Message-ID: Subject: Re: [PATCHv2] support ZSTD compression algorithm From: Mark Wielaard To: Martin =?UTF-8?Q?Li=C5=A1ka?= Cc: elfutils-devel@sourceware.org Date: Mon, 19 Dec 2022 16:16:42 +0100 In-Reply-To: <53071eba-0cbc-fb7e-c78c-dfc52cc2843f@suse.cz> References: <24d7165b-b8ac-ea5d-a046-aec2203696a9@suse.cz> <53071eba-0cbc-fb7e-c78c-dfc52cc2843f@suse.cz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-3032.6 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Martin, On Mon, 2022-12-19 at 15:21 +0100, Martin Li=C5=A1ka wrote: > > > + else > > > + error (0, 0, "Couldn't get chdr for section %zd", ndx); > >=20 > > Shouldn't this error be fatal? >=20 > What do you use for fatal errors? Depends a bit on context. It might be that this error isn't fatal, then zero as first (status) argument is fine, just know that the program will just continue. And it looked like not all callers were prepared for this function to return with a bogus return value. If it is fatal then depending on context you either call error_exit (0, "Couldn't get chdr for section %zd", ndx); [see system.h, this really is just error (EXIT_FAILURE, 0, ...)] if the program needs to terminate right now. Or you return a special value from the function (assuming all callers check for an error here). And/Or if the program needs a cleanup you'll goto cleanup (as is done in process_file). Cheers, Mark