From nobody Thu Mar 28 15:56:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1584552780; cv=none; d=zohomail.com; s=zohoarc; b=P0MoW8Xfr+PBxmvD6PtGker7xs1ffOLyRreMKigtt6Xrj2GLZvSkUMhor+rc4a77+Hal0jGoble9KoefTf79pqvnudAoFCterC7+UQic6cVp8q0tKJKpYHVdCe0+omo9l88DIKHw+nG0844eyEdGSymQyYiHhaOYTz9+hglRKyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584552780; 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=vY5SnaUIFW+cBhTtBQJUPMO7mEN5gdGPS8I4dNozjT8=; b=ncFn7Hnrc55RjUFWcxlwFpFbUo68yn5cEO22nK8OWjvBg6gmEqw8Wvzn/UU/H6nAjI56sACmObIOBYcMGbBNp534CWh7HqyQteZyYl+COZR1LOmGmYUHvM4wXMMqe4Fow9Y/BmYbK+Qiq8w4jr4i/37WljCPwDe1B6QbCQlKrxs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584552780797938.1099038916544; Wed, 18 Mar 2020 10:33:00 -0700 (PDT) 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-346-B3weTHFnM0-bXbiOc9eAzg-1; Wed, 18 Mar 2020 13:32:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E46CA18B9F69; Wed, 18 Mar 2020 17:32:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 285415C1A0; Wed, 18 Mar 2020 17:32:28 +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 8291418089CD; Wed, 18 Mar 2020 17:32:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02IHWOEj029235 for ; Wed, 18 Mar 2020 13:32:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BFD417B91; Wed, 18 Mar 2020 17:32:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED544627D8 for ; Wed, 18 Mar 2020 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584552779; 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=vY5SnaUIFW+cBhTtBQJUPMO7mEN5gdGPS8I4dNozjT8=; b=T+84/SbYlthQ0xvREKQZZT5bQfWQSVc7MxfdrVlhi511S/DF9oLosMK8u1EvBPVBMR/sEb zidrMRJn7rmTgU5YbeE5PGPDbZEZRohSwx6dcUJl6HAkf+hsrzSy6mu7Da8vpX26QNzkXJ EKY2Fz9Yz9LyyDMIrfzgaHdF7CyZGiM= X-MC-Unique: B3weTHFnM0-bXbiOc9eAzg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/6] qemuDomainCreateDeviceRecursive: Report error if mkdir() fails Date: Wed, 18 Mar 2020 18:32:11 +0100 Message-Id: <1e4c186830ac98af83d9da9636a78977645c23d9.1584552044.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The virFileMakePathWithMode() which is our recursive version of mkdir() fails, it simply just returns a negative value with errno set. No error is reported (as compared to virFileTouch() for instance). Signed-off-by: Michal Privoznik Reviewed-by: Pavel Mores --- src/qemu/qemu_domain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0e2252f6cf..48bf5ae559 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -14643,8 +14643,12 @@ qemuDomainCreateDeviceRecursive(const char *device, * proper owner and mode. Bind mount only after that. */ } else if (isDir) { if (create && - virFileMakePathWithMode(devicePath, sb.st_mode) < 0) + virFileMakePathWithMode(devicePath, sb.st_mode) < 0) { + virReportSystemError(errno, + _("Unable to make dir %s"), + devicePath); goto cleanup; + } } else { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("unsupported device type %s 0%o"), --=20 2.24.1