Re: [PATCH v3 2/3] relative_path should honor DOS and UNC paths
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 17, 2013, 16:12 UTC
- Message-ID
- <xmqqli2v1l7f.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <2c56935842ceef4d5933c299dd2d55286eb0ba3a.1379406453.git.worldhello.net@gmail.com>
Jiang Xin <worldhello.net@gmail.com> writes:
Show 12 quoted lines
> diff --git a/compat/mingw.h b/compat/mingw.h
> index bd0a88b..06e9f49 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -311,6 +311,15 @@ int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format
>
> #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
> #define is_dir_sep(c) ((c) == '/' || (c) == '\\')
> +static inline int is_unc_path(const char *path)
> +{
> + if (!is_dir_sep(*path) || !is_dir_sep(*(path+1)) || is_dir_sep(*(path+2)))
> + return 0;If path[1] == '\0', it would be !is_dir_sep() and we end up inspecting past the end of the string?