From patchwork Fri Aug 12 16:58:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 658724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3s9rhD4r3cz9t0J for ; Sat, 13 Aug 2016 02:59:08 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 08ECB10D7F; Fri, 12 Aug 2016 09:59:06 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 0785F10D7E for ; Fri, 12 Aug 2016 09:59:05 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 65D9E4202CC for ; Fri, 12 Aug 2016 10:59:04 -0600 (MDT) X-ASG-Debug-ID: 1471021143-09eadd387df7760001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id SdD4IsEE7BKJQriR (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Aug 2016 10:59:03 -0600 (MDT) X-Barracuda-Envelope-From: guru@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO relay9-d.mail.gandi.net) (217.70.183.199) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 12 Aug 2016 16:59:03 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.199 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.199 X-Barracuda-RBL-IP: 217.70.183.199 Received: from mfilter19-d.gandi.net (mfilter19-d.gandi.net [217.70.178.147]) by relay9-d.mail.gandi.net (Postfix) with ESMTP id BA9A8406E0 for ; Fri, 12 Aug 2016 18:59:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter19-d.gandi.net Received: from relay9-d.mail.gandi.net ([IPv6:::ffff:217.70.183.199]) by mfilter19-d.gandi.net (mfilter19-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id z0IhgImvv6vZ for ; Fri, 12 Aug 2016 18:59:00 +0200 (CEST) X-Originating-IP: 74.125.82.42 Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) (Authenticated sender: guru@ovn.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id E9BA840367 for ; Fri, 12 Aug 2016 18:58:59 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id f65so38125818wmi.0 for ; Fri, 12 Aug 2016 09:58:59 -0700 (PDT) X-Gm-Message-State: AEkoouuBdxBYA60Kc5Msw4jQ6i1EK3aOXv5CtP/ihDu3hhm2ye+asPEleqwowNjzPjxJeJHC1NipeoNc9959fw== X-Received: by 10.25.142.203 with SMTP id q194mr2774072lfd.11.1471021139537; Fri, 12 Aug 2016 09:58:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.5.232 with HTTP; Fri, 12 Aug 2016 09:58:58 -0700 (PDT) In-Reply-To: <20160812073848.8444-1-aserdean@cloudbasesolutions.com> References: <20160812073848.8444-1-aserdean@cloudbasesolutions.com> X-CudaMail-Envelope-Sender: guru@ovn.org From: Guru Shetty Date: Fri, 12 Aug 2016 09:58:58 -0700 X-Gmail-Original-Message-ID: Message-ID: X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-811037071 X-CudaMail-DTE: 081216 X-CudaMail-Originating-IP: 217.70.183.199 To: Alin Serdean X-ASG-Orig-Subj: [##CM-E2-811037071##]Re: [ovs-dev] Windows: Report absolute file name X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1471021143 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Cc: "dev@openvswitch.org" Subject: Re: [ovs-dev] Windows: Report absolute file name X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" On 12 August 2016 at 00:39, Alin Serdean wrote: > On Windows if a file path contains ":" we can safely say it is an absolute > file name. > > This patch allows file_name checks to report correctly when using > "abs_file_name". > > Found by testing. > > Signed-off-by: Alin Gabriel Serdean > I will add the following incremental before committing. > --- > lib/util.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/util.c b/lib/util.c > index 241a7f1..689a9de 100644 > --- a/lib/util.c > +++ b/lib/util.c > @@ -926,6 +926,10 @@ abs_file_name(const char *dir, const char *file_name) > { > if (file_name[0] == '/') { > return xstrdup(file_name); > +#ifdef _WIN32 > + } else if (strchr(file_name, ':')) { > + return xstrdup(file_name); > +#endif > } else if (dir && dir[0]) { > char *separator = dir[strlen(dir) - 1] == '/' ? "" : "/"; > return xasprintf("%s%s%s", dir, separator, file_name); > -- > 2.9.2.windows.1 > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > diff --git a/lib/util.c b/lib/util.c index 689a9de..21f0661 100644 --- a/lib/util.c +++ b/lib/util.c @@ -920,6 +920,9 @@ base_name(const char *file_name) * which itself must be absolute. 'dir' may be null or the empty string, in * which case the current working directory is used. * + * Additionally on Windows, if 'file_name' has a ':', returns a copy of + * 'file_name' + * * Returns a null pointer if 'dir' is null and getcwd() fails. */