path_max
authorDebian X Strike Force <debian-x@lists.debian.org>
Mon, 10 Jun 2024 16:59:35 +0000 (19:59 +0300)
committerTimo Aaltonen <tjaalton@debian.org>
Mon, 10 Jun 2024 16:59:35 +0000 (19:59 +0300)
Gbp-Pq: Name path_max.diff

src/gallium/auxiliary/pipe-loader/pipe_loader.c
src/util/tests/cache_test.cpp
src/util/tests/process_test.c

index 8ffb416b3a1c3c63b759c367c9777900548d3b9b..38dda610bac1050b6742e14c9a846ed598ef533e 100644 (file)
 #define PATH_MAX _MAX_PATH
 #endif
 
+#if !defined(PATH_MAX) && defined(__GNU__)
+#define PATH_MAX (4096)
+#endif
+
 #define MODULE_PREFIX "pipe_"
 
 static int (*backends[])(struct pipe_loader_device **, int) = {
index 48d723b47422a68c2bc553f09088bb31e70b1e63..ce4fc0762bc853e0f38f2ea97b5562b52009074b 100644 (file)
@@ -83,8 +83,8 @@ check_directories_created(void *mem_ctx, const char *cache_dir)
 {
    bool sub_dirs_created = false;
 
-   char buf[PATH_MAX];
-   if (getcwd(buf, PATH_MAX)) {
+   char *buf = getcwd(NULL, 0);
+   if (buf) {
       char *full_path = ralloc_asprintf(mem_ctx, "%s%s", buf, ++cache_dir);
       struct stat sb;
       if (stat(full_path, &sb) != -1 && S_ISDIR(sb.st_mode))
index dd4e7bf8c7acf1dd7c689fb32875d31f35d02d64..0e937e2c134fa46f69e00a43b633f78fabc94638 100644 (file)
 #define PATH_MAX MAX_PATH
 #endif
 
+#if !defined(PATH_MAX) && defined(__GNU__)
+#define PATH_MAX (4096)
+#endif
+
 static bool error = false;
 
 static void