From nobody Mon Feb 9 23:00:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1646643685; cv=none; d=zohomail.com; s=zohoarc; b=f9ctpvRr+rpx3m+r8O6aJ6HTRiKJbg+CfSpN3p/j4PPNgWImGqDpco+qSkMIRGDniiGkQEHIogS+6txbwwlxvjjoXwS4WVwQGFJ4lG2ww73c5YhVuFPD1VQG6qJBdPz+Ho3rv/TFtfcpZdi13sIPqxlRHdJPumkc/nItVFEFOjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646643685; 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=6b58A/FQA6TIpkr/2Ud3WTi0td6NnTVmAmKlhCiAJ1I=; b=j8O+tPYn/ZPcf3rVdjzWjTvQQBM48vgFMJsYYn1g9XZUtegy4MTQMcPg3RAKepVutE0LE7/c3DJ11+O/2mMomL4kTiztrJpIC5iAdR0GY5KZFiQjtMKqrpFp4b/+gpX/g0Vc/kuyPmkYrgGYhX0MxLvMcf3FCOm7cP2JKE84/aU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1646643685669571.5096926020101; Mon, 7 Mar 2022 01:01:25 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-259-uctjnOgxMzaX47tYpzFsMQ-1; Mon, 07 Mar 2022 04:01:20 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03F1E3C11C63; Mon, 7 Mar 2022 09:01:18 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E135356D18E; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C056A1931BDE; Mon, 7 Mar 2022 09:01:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E96D1931BD5 for ; Mon, 7 Mar 2022 09:01:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D488F1F473; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F8E1FD88 for ; Mon, 7 Mar 2022 09:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646643684; 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=6b58A/FQA6TIpkr/2Ud3WTi0td6NnTVmAmKlhCiAJ1I=; b=BzzLKFtMRsaYkJrMBs8IJkfLLL/pb8Z1EXiV5iCMwwYPd9WpEEv9V8Qci2ZiQETKYbtd+Q k/GAJK4pDVe83TXF7rJ80LeP9LklMqWZjjUNtES+BW1DFqgy4522hD8g3E2o8MImP/m3aO SOIhwP8pMePlmImDsCjMXFOP63innmY= X-MC-Unique: uctjnOgxMzaX47tYpzFsMQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 07/17] lxc_fuse: Prefer O_ACCMODE instead of & 3 Date: Mon, 7 Mar 2022 10:00:57 +0100 Message-Id: <8d8c4afa1df1d688eb7f75e239ac1fda60e2ca24.1646643526.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1646643687698100009 Content-Type: text/plain; charset="utf-8" In lxcProcOpen() we want to check whether the /proc/memfile is being opened only for read. For that we check the fi->flags which correspond to flags open() call. Instead of explicitly masking the last two bits use O_ACCMODE constant, which is deemed to be more portable. Signed-off-by: Michal Privoznik --- src/lxc/lxc_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b6b653e8cd..683d01525f 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -114,7 +114,7 @@ lxcProcOpen(const char *path, if (STRNEQ(path, fuse_meminfo_path)) return -ENOENT; =20 - if ((fi->flags & 3) !=3D O_RDONLY) + if ((fi->flags & O_ACCMODE) !=3D O_RDONLY) return -EACCES; =20 return 0; --=20 2.34.1