View | Details | Raw Unified | Return to bug 106464
Collapse All | Expand All

(-)./modules/fastcgi/fastcgi.lisp (-1 / +2 lines)
Lines 146-152 Link Here
146
146
147
147
148
; --------------   "C" functions
148
; --------------   "C" functions
149
;(c-lines "#include \"fastcgi.h\"~%"); completely wrapped
149
(eval-when (compile)
150
  (setq ffi:*output-c-functions* t))
150
151
151
; Our wrappers
152
; Our wrappers
152
(def-call-out fcgi_getenv       (:arguments (var c-string))               (:return-type c-string))
153
(def-call-out fcgi_getenv       (:arguments (var c-string))               (:return-type c-string))
(-)./modules/fastcgi/fastcgi_wrappers.c (+23 lines)
Lines 41-46 Link Here
41
/* Crank this up as needed */
41
/* Crank this up as needed */
42
#define TEMPBUFSIZE 65536
42
#define TEMPBUFSIZE 65536
43
43
44
#ifdef __FreeBSD__
45
char* t_strndup(const char* string, size_t n)
46
{
47
	char* copy_string = 0;
48
49
	if(0 == string || 0 == n)
50
		return 0;
51
	
52
	copy_string = (char*) malloc(n + 1);	
53
	if(0 == copy_string)
54
		return 0;
55
	
56
	memcpy(copy_string, string, n);
57
	*(copy_string + n) = '\0';		
58
59
	return copy_string;
60
}
61
#endif
62
44
/* Local functions */
63
/* Local functions */
45
static char * read_stdio(FILE *);
64
static char * read_stdio(FILE *);
46
static int    write_stdio(FILE *, char *, int);
65
static int    write_stdio(FILE *, char *, int);
Lines 91-97 Link Here
91
      result[i+1] = NULL;
110
      result[i+1] = NULL;
92
    }
111
    }
93
    else {
112
    else {
113
#ifdef __FreeBSD__
114
		result[i] = t_strndup(*envp, equ - *envp);
115
#else							
94
      result[i] = strndup(*envp, equ - *envp);
116
      result[i] = strndup(*envp, equ - *envp);
117
#endif	  
95
      result[i+1] = strdup(equ + 1);
118
      result[i+1] = strdup(equ + 1);
96
    }
119
    }
97
  }
120
  }

Return to bug 106464