From patchwork Fri Aug 12 17:21:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin Serdean X-Patchwork-Id: 658736 X-Patchwork-Delegate: guru@ovn.org 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 3s9sBx25Ykz9stY for ; Sat, 13 Aug 2016 03:22:16 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 732A810D95; Fri, 12 Aug 2016 10:22:12 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 8297110D67 for ; Fri, 12 Aug 2016 10:22:10 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id E1A691E0231 for ; Fri, 12 Aug 2016 11:22:09 -0600 (MDT) X-ASG-Debug-ID: 1471022528-09eadd387dff590001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id g7HJdklpaAl3vR2Z (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Aug 2016 11:22:08 -0600 (MDT) X-Barracuda-Envelope-From: aserdean@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx1-pf2.cudamail.com with SMTP; 12 Aug 2016 17:22:07 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 7C5AD402D9; Fri, 12 Aug 2016 20:22:06 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mWgm3GA2D402; Fri, 12 Aug 2016 20:21:46 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 08BC33FC5F; Fri, 12 Aug 2016 20:21:46 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0301.000; Fri, 12 Aug 2016 19:21:45 +0200 X-CudaMail-Envelope-Sender: aserdean@cloudbasesolutions.com From: Alin Serdean To: Guru Shetty X-CudaMail-MID: CM-E2-811039192 X-CudaMail-DTE: 081216 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [ovs-dev] Windows: Report absolute file name X-ASG-Orig-Subj: [##CM-E2-811039192##]RE: [ovs-dev] Windows: Report absolute file name Thread-Index: AQHR9GyXspQHJqS+oUKmSEHKNbcQbKBFa0EAgAAnuxA= Date: Fri, 12 Aug 2016 17:21:44 +0000 Message-ID: <6FDA0CACF4BC624BBE12167875D71C9B407E5112@CBSEX1.cloudbase.local> References: <20160812073848.8444-1-aserdean@cloudbasesolutions.com> In-Reply-To: Accept-Language: en-US, it-IT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.363392 p=-0.411765 Source Normal X-MessageSniffer-Rules: 0-0-0-15552-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1471022528 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.10 X-Barracuda-Spam-Status: No, SCORE=0.10 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC0_MISMATCH_TO, HTML_MESSAGE, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31963 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.00 HTML_MESSAGE BODY: HTML included in message 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 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" Sorry I forgot about it! Thanks for the review I will respin the patch and add you as co-author. Thanks, Alin. From: Guru Shetty [mailto:guru@ovn.org] Sent: Friday, August 12, 2016 7:59 PM To: Alin Serdean Cc: dev@openvswitch.org Subject: Re: [ovs-dev] Windows: Report absolute file name 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. -- 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. */ --- 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);