util/test: Use MAX_PATH on Windows
authorDaniel Stone <daniels@collabora.com>
Thu, 26 Mar 2020 13:01:58 +0000 (13:01 +0000)
committerDaniel Stone <daniels@collabora.com>
Fri, 27 Mar 2020 10:32:47 +0000 (10:32 +0000)
Windows provides MAX_PATH rather than PATH_MAX for the maximum allowable
path length. This is not a limit on the length of filename which can
exist on the filesystem, but a length on the length of path which can be
passed to Win32 API calls.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4304>

src/util/process_test.c

index 708c2766eb97f45d7d7ee1fd69c796a910f2d0ea..00703df6034c9b274cfbd60db7e14c5ee8eee6ce 100644 (file)
 #include <limits.h>
 #include <stdlib.h>
 
+#if DETECT_OS_WINDOWS && !defined(PATH_MAX)
+#include <windows.h>
+#define PATH_MAX MAX_PATH
+#endif
+
 bool error = false;
 
 static void