diff mbox

[ovs-dev] Windows: Report absolute file name

Message ID 6FDA0CACF4BC624BBE12167875D71C9B407E5112@CBSEX1.cloudbase.local
State Not Applicable
Delegated to: Guru Shetty
Headers show

Commit Message

Alin Serdean Aug. 12, 2016, 5:21 p.m. UTC
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 <aserdean@cloudbasesolutions.com>
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] Windows: Report absolute file name



On 12 August 2016 at 00:39, Alin Serdean <aserdean@cloudbasesolutions.com<mailto:aserdean@cloudbasesolutions.com>> 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 <aserdean@cloudbasesolutions.com<mailto:aserdean@cloudbasesolutions.com>>


I will add the following incremental before committing.
--
2.9.2.windows.1
_______________________________________________
dev mailing list
dev@openvswitch.org<mailto:dev@openvswitch.org>
http://openvswitch.org/mailman/listinfo/dev

Comments

Gurucharan Shetty Aug. 12, 2016, 5:26 p.m. UTC | #1
On 12 August 2016 at 10:21, Alin Serdean <aserdean@cloudbasesolutions.com>
wrote:

> Sorry I forgot about it!
>
>
>
> Thanks for the review I will respin the patch and add you as co-author.
>
It is already applied. Thanks!


>
>
> Thanks,
>
> Alin.
>
>
>
> *From:* Guru Shetty [mailto:guru@ovn.org]
> *Sent:* Friday, August 12, 2016 7:59 PM
> *To:* Alin Serdean <aserdean@cloudbasesolutions.com>
> *Cc:* dev@openvswitch.org
> *Subject:* Re: [ovs-dev] Windows: Report absolute file name
>
>
>
>
>
>
>
> On 12 August 2016 at 00:39, Alin Serdean <aserdean@cloudbasesolutions.com>
> 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 <aserdean@cloudbasesolutions.com>
>
>
>
> I will add the following incremental before committing.
>
> 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);
> --
> 2.9.2.windows.1
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
>
>
diff mbox

Patch

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);