From patchwork Wed Aug 12 15:17:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lilydjwg X-Patchwork-Id: 1751 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id EBD4B1A7E1E10 for ; Wed, 12 Aug 2020 15:27:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED=0.001, DKIM_INVALID=1,DKIM_SIGNED=0.1,FREEMAIL_FROM=0.5,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=0.001,RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,T_DMARC_POLICY_NONE=0.01,T_DMARC_SIMPLE_DKIM=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.0.19] [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 12 Aug 2020 15:27:10 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 05CEA1D37114B4; Wed, 12 Aug 2020 15:27:09 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Gqqiwn4o Authentication-Results: orion.archlinux.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Gqqiwn4o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ffktdze0DtTjyzpDWiedAstzNUK50ApkIQQm7pb2nq8=; b=Gqqiwn4oDCusquWaQtFIvqvIEkFtTbMURbmYnwmYHkpvWSQijmVdtvpI5VT1Dymora DP7mzznqvXQLbjV0SgzmlykirjrAKw1EV9R5dVb1J/vFxvtl0zqqy/xskeMkM5SLSXwt SAL+yVA1xaLLqFGCCuDXYugSJo2Te3gW7R3EKK3uZ26FTJR84wu6qohAuPldG3pVvbuW ku/idsoWmDsU2RdAW4P3/QraoiCXHF0V2Js9taZsPiDddGANuEeZN51F3kFVENQt8R0X SwKoRmmYqvKVwmOHD028L3Z8GJ6DY/ktifsgY/PaF0519DiNPakFKfGUrZEgwVZJwjZr zsbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ffktdze0DtTjyzpDWiedAstzNUK50ApkIQQm7pb2nq8=; b=L2G7ogOJdlOGZrn6xpUvXRONMQEtCPQwXb79EC2PZ1ePzBCVV6l00lgl5jO+Y1REKl 0JgmWxWjDt/W3uyiaVWFXlCc4850GEtTTr2psAbiZ+Ynl1EEBxiAtEnh5ZsDl+AmYii8 OrwIvOXM2wEFLSNhb9Cxx9UsFQehmkqgm5EUKoctf45x4ALxd6OC5A82/V3O9yZuUDjZ MJC3MG8yu0y2BM12TXuzNtaROTjYNaWYhhrs2jCkfD8H4DzebC2WmTiRqyhmmDVU7Fsy A6mkqiM6REa6yfZNCYN7dSh7pZbOX35oI74qBpsUygcGmkNNR5wk6hAll7l3cDURrjuu o2HQ== X-Gm-Message-State: AOAM533yq30LASMiYE6kQGE7zIBNs22Dith2D2Jh+he0ulGU2nNED8/T l2T38E1g91eWXL+1M5NR+uVTfPA7/NHWsg== X-Google-Smtp-Source: ABdhPJxqElq46Xr0PKyQrICAK2QKPgfIhOt0Tt+mavBoybVJ7y9M2eV8UN7T82YNOjsZ35ktjUXkcg== X-Received: by 2002:a17:90a:22a3:: with SMTP id s32mr543751pjc.49.1597246022854; Wed, 12 Aug 2020 08:27:02 -0700 (PDT) From: lilydjwg To: Discussion list for pacman development Date: Wed, 12 Aug 2020 23:17:49 +0800 Message-Id: <20200812151748.1760219-1-lilydjwg@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200812145324.GA795@b42-desktop.localdomain> References: <20200812145324.GA795@b42-desktop.localdomain> MIME-Version: 1.0 Subject: [pacman-dev] [PATCH v2] lock file may be left behind when a signal arrives while in cleanup X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" When a SIGINT or SIGHUP arrives before alpm_unlock (in alpm_release) but after remove_soft_interrupt_handler, the lock file will be left behind. Signed-off-by: lilydjwg --- Oops, here is an updated version that calls _alpm_handle_unlock before remove_soft_interrupt_handler. It should be fine to call _alpm_handle_unlock twice. src/pacman/pacman.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index fefd3fa4..8928ccc4 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -287,6 +287,9 @@ static void setuseragent(void) */ static void cleanup(int ret) { + if(config) { + _alpm_handle_unlock(config->handle); + } remove_soft_interrupt_handler(); if(config) { /* free alpm library resources */