Path: blob/main/lang/clisp/files/patch-modules__fastcgi__fastcgi_wrappers.c
16461 views
--- modules/fastcgi/fastcgi_wrappers.c.orig 2018-11-12 00:05:07 UTC1+++ modules/fastcgi/fastcgi_wrappers.c2@@ -41,7 +41,26 @@ extern char **environ;34/* Crank this up as needed */5#define TEMPBUFSIZE 655366+7+#ifdef __FreeBSD__8+char* t_strndup(const char* string, size_t n)9+{10+ char* copy_string = 0;11+12+ if(0 == string || 0 == n)13+ return 0;14+15+ copy_string = (char*) malloc(n + 1);16+ if(0 == copy_string)17+ return 0;18+19+ memcpy(copy_string, string, n);20+ *(copy_string + n) = '\0';2122+ return copy_string;23+}24+#endif25+26/* Local functions */27static char * read_stdio(FILE *);28static int write_stdio(FILE *, char *, int);29@@ -93,7 +112,11 @@ char ** fcgi_env() {30result[i+1] = NULL;31}32else {33+#ifdef __FreeBSD__34+ result[i] = t_strndup(*envp, equ - *envp);35+#else36result[i] = strndup(*envp, equ - *envp);37+#endif38result[i+1] = strdup(equ + 1);39}40}414243