blob: 5205783cb2fc8f0d60c84d4ffdd206d4f4adf953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
$NetBSD: patch-bb,v 1.3 2019/10/11 09:27:16 jperkin Exp $
Do use non-standard getcwd(NULL, 0); This unbreaks cvs on Interix.
Disable broken custom getcwd() on Apple, it breaks on Catalina.
--- lib/xgetcwd.c.orig 2005-09-19 21:12:25.000000000 +0000
+++ lib/xgetcwd.c
@@ -25,8 +25,13 @@
#include "xgetcwd.h"
#include <errno.h>
+#include <limits.h>
+#ifdef __APPLE__
+#include <unistd.h>
+#else
#include "getcwd.h"
+#endif
#include "xalloc.h"
/* Return the current directory, newly allocated.
@@ -36,8 +41,8 @@
char *
xgetcwd (void)
{
- char *cwd = getcwd (NULL, 0);
+ char *cwd = xmalloc (PATH_MAX);
if (! cwd && errno == ENOMEM)
xalloc_die ();
- return cwd;
+ return getcwd (cwd, PATH_MAX);
}
|