Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c
16461 views
1
--- modules/fastcgi/fastcgi_wrappers.c.orig 2018-11-12 00:05:07 UTC
2
+++ modules/fastcgi/fastcgi_wrappers.c
3
@@ -41,7 +41,26 @@ extern char **environ;
4
5
/* Crank this up as needed */
6
#define TEMPBUFSIZE 65536
7
+
8
+#ifdef __FreeBSD__
9
+char* t_strndup(const char* string, size_t n)
10
+{
11
+ char* copy_string = 0;
12
+
13
+ if(0 == string || 0 == n)
14
+ return 0;
15
+
16
+ copy_string = (char*) malloc(n + 1);
17
+ if(0 == copy_string)
18
+ return 0;
19
+
20
+ memcpy(copy_string, string, n);
21
+ *(copy_string + n) = '\0';
22
23
+ return copy_string;
24
+}
25
+#endif
26
+
27
/* Local functions */
28
static char * read_stdio(FILE *);
29
static int write_stdio(FILE *, char *, int);
30
@@ -93,7 +112,11 @@ char ** fcgi_env() {
31
result[i+1] = NULL;
32
}
33
else {
34
+#ifdef __FreeBSD__
35
+ result[i] = t_strndup(*envp, equ - *envp);
36
+#else
37
result[i] = strndup(*envp, equ - *envp);
38
+#endif
39
result[i+1] = strdup(equ + 1);
40
}
41
}
42
43