From nobody Tue Feb 10 02:54:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574855956; cv=none; d=zohomail.com; s=zohoarc; b=L2GdJe7yiauDDur6IrVvS2GTeDe5+p/Z2K/SwI/Ix72kCBFpRmYzC5IPNO0BXUk7VpvaX3q3GbFW/98wX9gRys/bE+DYxVJRQVashpZgW5QHCGCi53jk6R8Bp5uPPp8Mj8InXrHebepJxV+Pq2W6AIqWWlkpEkZKn8VR59bBm1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574855956; h=Content-Type:Content-Transfer-Encoding:Cc: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=p8tsVTUfoEfZv9VhDPcAAEq3rQMQDEoIiccaTGADpU8=; b=ho/0OVLxpXA2ULSwS/XkK7+KgAKwPdrnmgn34liRYjzAQkch3u4rFHPWfv5kI1UlIh3kDEdFJEwTSklpYo1gAMBIWKokp4Cf1/jDDsU7kvldQdfZY+7iXp0Lbio31GZgfX1ukPUnLsxWG32Q4W2x8FBcjhCHboXiRhU2FlH7NCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574855956721165.3037805096984; Wed, 27 Nov 2019 03:59:16 -0800 (PST) Received: from localhost ([::1]:37426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvyV-0006cn-GP for importer@patchew.org; Wed, 27 Nov 2019 06:59:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZvt3-0000Yu-OG for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZvt1-0006DV-Ap for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:37 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:41896 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iZvsw-0006AC-Q6 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 06:53:31 -0500 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-175-S04vU510OGONQCQnN3iTjg-1; Wed, 27 Nov 2019 06:53:26 -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 EDA6E107ACE3 for ; Wed, 27 Nov 2019 11:53:25 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C9E610246E3; Wed, 27 Nov 2019 11:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574855610; h=from:from:reply-to:subject:subject: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=p8tsVTUfoEfZv9VhDPcAAEq3rQMQDEoIiccaTGADpU8=; b=ZXZZFns+sYE8CiQLbjDkeIv69+5T8k/AZLpuQBFcUtfZY/Jaz/JkbkHKrH4uscsz5iiMTw QFrzjyteJlnn7hjQhx7wsYBWkWamfF+bVx0MNWnv70CIm4xtBwD5eXv/4OtvNlUvlItbf4 xDbUmy0D+Ta1KFbwfe0ar2k3IYD8VPY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 6/7] osdep: add qemu_unlink() Date: Wed, 27 Nov 2019 15:52:01 +0400 Message-Id: <20191127115202.375107-7-marcandre.lureau@redhat.com> In-Reply-To: <20191127115202.375107-1-marcandre.lureau@redhat.com> References: <20191127115202.375107-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: S04vU510OGONQCQnN3iTjg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add a helper function to match qemu_open() which may return files under the /dev/fdset prefix. Those shouldn't be removed, since it's only a qemu namespace. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- include/qemu/osdep.h | 1 + util/osdep.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 0f97d68586..9bd3dcfd13 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -462,6 +462,7 @@ int qemu_mprotect_none(void *addr, size_t size); =20 int qemu_open(const char *name, int flags, ...); int qemu_close(int fd); +int qemu_unlink(const char *name); #ifndef _WIN32 int qemu_dup(int fd); #endif diff --git a/util/osdep.c b/util/osdep.c index 3f04326040..f7d06050f7 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -370,6 +370,21 @@ int qemu_close(int fd) return close(fd); } =20 +/* + * Delete a file from the filesystem, unless the filename is /dev/fdset/... + * + * Returns: On success, zero is returned. On error, -1 is returned, + * and errno is set appropriately. + */ +int qemu_unlink(const char *name) +{ + if (g_str_has_prefix(name, "/dev/fdset/")) { + return 0; + } + + return unlink(name); +} + /* * A variant of write(2) which handles partial write. * --=20 2.24.0