[ovs-dev] Windows: Report absolute file name

Guru Shetty guru at ovn.org
Fri Aug 12 17:26:08 UTC 2016


On 12 August 2016 at 10:21, Alin Serdean <aserdean at 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 at ovn.org]
> *Sent:* Friday, August 12, 2016 7:59 PM
> *To:* Alin Serdean <aserdean at cloudbasesolutions.com>
> *Cc:* dev at openvswitch.org
> *Subject:* Re: [ovs-dev] Windows: Report absolute file name
>
>
>
>
>
>
>
> On 12 August 2016 at 00:39, Alin Serdean <aserdean at 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 at 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 at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
>
>



More information about the dev mailing list