From nobody Mon Feb 9 01:22:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578471548; cv=none; d=zohomail.com; s=zohoarc; b=j9KKbNXjTWrI+SVgF7MsP4JqoivyJGGlcUlVLtbxaeI8wj/8zXV3VEsUWA6Ah3jiIF9A72tPTswZR2eDV8dgTmWFIeL0Pb0xuoMgPdGo2kwO2FCiZqWan1dnfaO9oBXFAgefZW9JFDC2s5G57bJz8PMxaCniQ/L0F29iajD2Ws4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578471548; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AO1pHjtfGrwOBPrMf8Qu7+iuRyL9NGJ26wQY6Czzp5U=; b=fcG5kmOBkJiNlKLBnhI16ORDeSB+G5FfjAiSxzym1VmWWxbw7ri6JinYKevD/XplkxmOiZwTRJQkPzT9IdUee0UJ6itXHilbcVA8X38APeh7rL6zOod0BBAA4hZLLAetUWpg2eXm7oWfl64R+TE2BcYGJ0sceBhhcYefmoFpV4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578471548923745.1858305491779; Wed, 8 Jan 2020 00:19:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-371-WQERVMXbMuKbLDTK0UEmSg-1; Wed, 08 Jan 2020 03:19:06 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 707EE1050905; Wed, 8 Jan 2020 08:19:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47D0B10013A7; Wed, 8 Jan 2020 08:19:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E3EB8820F7; Wed, 8 Jan 2020 08:18:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0088IeHA008277 for ; Wed, 8 Jan 2020 03:18:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 95DBE60CD1; Wed, 8 Jan 2020 08:18:40 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E9D260CC0 for ; Wed, 8 Jan 2020 08:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578471547; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AO1pHjtfGrwOBPrMf8Qu7+iuRyL9NGJ26wQY6Czzp5U=; b=IpHRIaC5nU/Xd/9Edhnr6MqTXQcJW60DTzbkAE0UsQ2FO1DZ0fG/HEBMleByIxEn0KqiUj 8fII3uRzXxvIJ/9dGcT2+mk5OpGQNbgVs8/x3NSkhVAG7RGPDuXLJAibyCnafV3RF8Dgr4 rEYgv9UYNhCuCeaeMJo9qUs6S8P11Jw= From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 8 Jan 2020 09:18:32 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] virchrdev: Drop needless 'cleanup' label in virChrdevLockFileCreate() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: WQERVMXbMuKbLDTK0UEmSg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/conf/virchrdev.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 766c264472..800e82869e 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -105,14 +105,13 @@ static char *virChrdevLockFilePath(const char *dev) static int virChrdevLockFileCreate(const char *dev) { g_autofree char *path =3D NULL; - int ret =3D -1; g_autofree char *pidStr =3D NULL; VIR_AUTOCLOSE lockfd =3D -1; pid_t pid; =20 /* build lock file path */ if (!(path =3D virChrdevLockFilePath(dev))) - goto cleanup; + return -1; =20 /* check if a log file and process holding the lock still exists */ if (virPidFileReadPathIfAlive(path, &pid, NULL) =3D=3D 0 && pid >=3D 0= ) { @@ -121,7 +120,7 @@ static int virChrdevLockFileCreate(const char *dev) _("Requested device '%s' is locked by " "lock file '%s' held by process %lld"), dev, path, (long long) pid); - goto cleanup; + return -1; } else { /* clean up the stale/corrupted/nonexistent lockfile */ unlink(path); @@ -142,14 +141,13 @@ static int virChrdevLockFileCreate(const char *dev) if (errno =3D=3D EACCES && geteuid() !=3D 0) { VIR_DEBUG("Skipping lock file creation for device '%s in path = '%s'.", dev, path); - ret =3D 0; - goto cleanup; + return 0; } virReportSystemError(errno, _("Couldn't create lock file for " "device '%s' in path '%s'"), dev, path); - goto cleanup; + return -1; } =20 /* write the pid to the file */ @@ -159,15 +157,11 @@ static int virChrdevLockFileCreate(const char *dev) "device '%s' in path '%s'"), dev, path); unlink(path); - goto cleanup; + return -1; } =20 /* we hold the lock */ - ret =3D 0; - - cleanup: - - return ret; + return 0; } =20 /** --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list