From nobody Fri Apr 19 14:13:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1617116386; cv=none; d=zohomail.com; s=zohoarc; b=kzSyrDiYFCz3yXpOsHBhYrybcMdPR3S1wZdfIuWYPR44/oOE5Jq7veWUHhRVODKSFLa1RpgW/JFedyi09VMwmDuOB4tnoYUHYmldYE1u7t9oXBRZYfO4O8X6sNzDkABHNSqDiyMsKqNUMU3R9qAUwgDDbQSibP2/qlBIq5xRhKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617116386; h=Content-Type:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=GZtsJAh7xB2lXpDPkJgnV+loVUza4IDtLWfzVC6wlXM=; b=PWb9n1/MZiDuGfrXioBk5jVdM0Wrnbqggzw7z9cqZ7xr+eSmglLTrqgQZG5L/SdfeH7qwZOGYWk4M26go5HXlKf/3J5nuFCFdVlliu00N6LA30PP/xxAVvGpq3L3Xwtzu242xdBK4uOScyzsAyMibCV3qq23J1SHnH1v/2GDOdI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1617116386016814.1444295538547; Tue, 30 Mar 2021 07:59:46 -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-88-tGPOLTAEN-mRTjcR4AOmXA-1; Tue, 30 Mar 2021 10:59:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7582E5B362; Tue, 30 Mar 2021 14:59:32 +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 22AAC5D9CC; Tue, 30 Mar 2021 14:59:30 +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 C611F18155DD; Tue, 30 Mar 2021 14:59:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12UEwvWw030203 for ; Tue, 30 Mar 2021 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5540F2157F38; Tue, 30 Mar 2021 14:58:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C2302157F27 for ; Tue, 30 Mar 2021 14:58:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A57EA181B7AD for ; Tue, 30 Mar 2021 14:58:53 +0000 (UTC) Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-Bytxk_3HO06ytS0HkwC7-g-1; Tue, 30 Mar 2021 10:58:51 -0400 Received: by mail-il1-f174.google.com with SMTP id d2so14381894ilm.10 for ; Tue, 30 Mar 2021 07:58:51 -0700 (PDT) X-MC-Unique: tGPOLTAEN-mRTjcR4AOmXA-1 X-MC-Unique: Bytxk_3HO06ytS0HkwC7-g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=GZtsJAh7xB2lXpDPkJgnV+loVUza4IDtLWfzVC6wlXM=; b=sPN/QpsaryA00fn5ePE+EQD2Ghe9qcjLsA76T+54aAZycBOC6A00SvdgAwJJrmwC12 ZzOnHWvv57k4MiTVQTw71ZrfNY7xEv8Uk/k7wYN9uAlAuWRsGlHfMyB/kLl4/DXUgf81 lEWXwJXVLRP6ZDAOyR0M6Zfhoj5l3uSXq+6lZapML7OdDpRxJ6mwS7iTH81tgjVrliLQ bOyUWR4WEiPZSJF29hcd8FRrJ9UM2o+xon0FIiuA7KP8tP2FPTC/1khtjjBcbvLoqfAb C+4G5ecDOsYlJFWSdzrMAnGjK0pDkmDVTR6cv2WDkwIqwCiCfgjW7g+rXrDBV8ZLkjHN HkUA== X-Gm-Message-State: AOAM533Cwhitv4G2kM3AsvtY1Acv+xhTPDPgfZ9XX6xggM7qV3PoPjfT k1bFDR4V/zSF9RVu4VSctjZEY6Hmh+EUklzRCaXX07iZ6Gs67F7S X-Google-Smtp-Source: ABdhPJzXrPX17nziScK99PcpmUXeXmZLo1Rjq4PUYB+fBJs1ufgy7qTTw8rvuS9Dgk4FK0APdeuMts57vrUJKpJvfog= X-Received: by 2002:a05:6e02:590:: with SMTP id c16mr13712489ils.65.1617116330215; Tue, 30 Mar 2021 07:58:50 -0700 (PDT) MIME-Version: 1.0 From: Luke Yue Date: Tue, 30 Mar 2021 22:58:36 +0800 Message-ID: Subject: [PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute() To: libvir-list@redhat.com X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.14 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 Content-Type: text/plain; charset="utf-8" The g_path_is_absolute() considers more situations than just a simply "path[0] =3D=3D '/'". Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12 Signed-off-by: Luke Yue --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 93fac200cc..3311eaff3d 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -3153,7 +3153,7 @@ virFileOpenTty(int *ttyprimary G_GNUC_UNUSED, int virFileAbsPath(const char *path, char **abspath) { - if (path[0] =3D=3D '/') { + if (g_path_is_absolute(path)) { *abspath =3D g_strdup(path); } else { g_autofree char *buf =3D g_get_current_dir(); --=20 2.31.1