From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 581C6385703F for ; Wed, 21 Dec 2022 11:09:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 581C6385703F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4EE8122C70; Wed, 21 Dec 2022 11:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1671620962; h=from:from:reply-to: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=B9Ho9XMka4szTURVCPJxHlf3ggZyslcn0IYQfl1YnpU=; b=X3ySOjGrEiTav5B6jVEHe7ZXTJZoQ/DEYjsGI8aBtEZTfWjsXR6X/WpPfcb/o8VNxhWjYH O4J8UbkCWRVg2MIRXLu7eM2fRVspGfKZA8cIOPwf/1LN2HQrW372CM7K7jyVoLQ3af3tkf r5sjyU/d6HeLFys1HmXId7oGqLWbC8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1671620962; h=from:from:reply-to: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=B9Ho9XMka4szTURVCPJxHlf3ggZyslcn0IYQfl1YnpU=; b=MHoiEO4FYzkiJk8xUEzni2e1MneozgmHp3zh+Re2VSP3BIrBsp0FHcb01V4WKNfzCkhA5g ap59BgTSlqp/NHAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 35A371390E; Wed, 21 Dec 2022 11:09:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WWcjDGLpomPTOQAAMHmgww (envelope-from ); Wed, 21 Dec 2022 11:09:22 +0000 Message-ID: <628dcc49-8836-c1b0-62bf-e6567a98dd62@suse.cz> Date: Wed, 21 Dec 2022 12:09:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCHv2] support ZSTD compression algorithm Content-Language: en-US To: Mark Wielaard Cc: elfutils-devel@sourceware.org References: <24d7165b-b8ac-ea5d-a046-aec2203696a9@suse.cz> <53071eba-0cbc-fb7e-c78c-dfc52cc2843f@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/19/22 16:16, Mark Wielaard wrote: > Hi Martin, > > On Mon, 2022-12-19 at 15:21 +0100, Martin Liška wrote: >>>> + else >>>> + error (0, 0, "Couldn't get chdr for section %zd", ndx); >>> >>> Shouldn't this error be fatal? >> >> 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). I think it's fine as we return UNSET in that case and the caller goes directly to cleanup (or abort is called for the second call site): enum ch_type schtype = get_section_chtype (scn, shdr, sname, ndx); if (schtype == UNSET) goto cleanup; Martin > > Cheers, > > Mark