From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 8EBB41F61A for ; Tue, 13 Dec 2022 10:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234957AbiLMKiX (ORCPT ); Tue, 13 Dec 2022 05:38:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbiLMKiF (ORCPT ); Tue, 13 Dec 2022 05:38:05 -0500 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D80B5F5E for ; Tue, 13 Dec 2022 02:38:02 -0800 (PST) Received: (qmail 14286 invoked by uid 109); 13 Dec 2022 10:38:02 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 13 Dec 2022 10:38:02 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 3970 invoked by uid 111); 13 Dec 2022 10:38:04 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 13 Dec 2022 05:38:04 -0500 Authentication-Results: peff.net; auth=none Date: Tue, 13 Dec 2022 05:38:01 -0500 From: Jeff King To: Junio C Hamano Cc: Jonathan Tan , git@vger.kernel.org Subject: Re: [PATCH v5 3/4] object-file: emit corruption errors when detected Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Dec 13, 2022 at 10:51:57AM +0900, Junio C Hamano wrote: > Jonathan Tan writes: > > > diff --git a/object-file.c b/object-file.c > > index 429e3a746d..e0cef8b906 100644 > > --- a/object-file.c > > +++ b/object-file.c > > @@ -1422,7 +1422,9 @@ static int loose_object_info(struct repository *r, > > struct object_info *oi, int flags) > > { > > int status = 0; > > + int fd; > > unsigned long mapsize; > > + const char *path = NULL; > > It may be OK to leave this uninitialized, as long as the contract of > open_loose_object() is that a successful opening will report the path > to the loose object file that was opened. Because ... Yeah, I'd agree that this initialization can be left off (and that the NULL checks later in the function are not needed). -Peff