summaryrefslogtreecommitdiff
path: root/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c')
-rw-r--r--lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c b/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c
new file mode 100644
index 000000000000..95297b568d42
--- /dev/null
+++ b/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c
@@ -0,0 +1,41 @@
+--- modules/fastcgi/fastcgi_wrappers.c.orig 2018-11-12 00:05:07 UTC
++++ modules/fastcgi/fastcgi_wrappers.c
+@@ -41,7 +41,26 @@ extern char **environ;
+
+ /* Crank this up as needed */
+ #define TEMPBUFSIZE 65536
++
++#ifdef __FreeBSD__
++char* t_strndup(const char* string, size_t n)
++{
++ char* copy_string = 0;
++
++ if(0 == string || 0 == n)
++ return 0;
++
++ copy_string = (char*) malloc(n + 1);
++ if(0 == copy_string)
++ return 0;
++
++ memcpy(copy_string, string, n);
++ *(copy_string + n) = '\0';
+
++ return copy_string;
++}
++#endif
++
+ /* Local functions */
+ static char * read_stdio(FILE *);
+ static int write_stdio(FILE *, char *, int);
+@@ -93,7 +112,11 @@ char ** fcgi_env() {
+ result[i+1] = NULL;
+ }
+ else {
++#ifdef __FreeBSD__
++ result[i] = t_strndup(*envp, equ - *envp);
++#else
+ result[i] = strndup(*envp, equ - *envp);
++#endif
+ result[i+1] = strdup(equ + 1);
+ }
+ }