From 68c1cdeb51bcac4e6d55e450b955a197cd6d0b42 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sat, 12 Nov 2022 16:38:55 -0500
Subject: Fix zix_current_path() on systems with a static PATH_MAX

---
 src/posix/filesystem_posix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c
index c5a783c..3bc5458 100644
--- a/src/posix/filesystem_posix.c
+++ b/src/posix/filesystem_posix.c
@@ -428,7 +428,8 @@ zix_current_path(ZixAllocator* const allocator)
 #if defined(PATH_MAX)
   // Some POSIX systems have a static PATH_MAX so we can store it on the stack
   char buffer[PATH_MAX] = {0};
-  return copy_path(allocator, getcwd(buffer, PATH_MAX), strlen(buffer));
+  getcwd(buffer, PATH_MAX);
+  return copy_path(allocator, buffer, strlen(buffer));
 
 #elif USE_PATHCONF
   // Others don't so we have to query PATH_MAX at runtime to allocate the result
-- 
cgit v1.2.1