diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-01-02 23:38:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-02 23:38:30 +0300 |
commit | 13432fc6dd4f9f78d0015611621991693f8fb218 (patch) | |
tree | 221e5140bf01713bf9c2f4fd05c0501ccee3ae40 /compat/mingw.h | |
parent | e0e1ac5db0235abba4038cf571a949c3f8c1b65c (diff) | |
parent | 4dc42c6c1867a52e22f1f04a1a247b5a7538b8af (diff) |
Merge branch 'js/mingw-reserved-filenames'
Forbid pathnames that the platform's filesystem cannot represent on
MinGW.
* js/mingw-reserved-filenames:
mingw: refuse paths containing reserved names
mingw: short-circuit the conversion of `/dev/null` to UTF-16
Diffstat (limited to 'compat/mingw.h')
-rw-r--r-- | compat/mingw.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compat/mingw.h b/compat/mingw.h index 3ec9fc36a5..714bc1d591 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -461,10 +461,17 @@ char *mingw_query_user_email(void); * * - contain any of the reserved characters, e.g. `:`, `;`, `*`, etc * + * - correspond to reserved names (such as `AUX`, `PRN`, etc) + * + * The `allow_literal_nul` parameter controls whether the path `NUL` should + * be considered valid (this makes sense e.g. before opening files, as it is + * perfectly legitimate to open `NUL` on Windows, just as it is to open + * `/dev/null` on Unix/Linux). + * * Returns 1 upon success, otherwise 0. */ -int is_valid_win32_path(const char *path); -#define is_valid_path(path) is_valid_win32_path(path) +int is_valid_win32_path(const char *path, int allow_literal_nul); +#define is_valid_path(path) is_valid_win32_path(path, 0) /** * Converts UTF-8 encoded string to UTF-16LE. |