[master] eec5e98 Replace strndup(), OS/X doesn't have it.

Poul-Henning Kamp phk at FreeBSD.org
Fri Nov 29 10:46:09 CET 2013


commit eec5e98e73fcbd3816e27dc0ac568a57e6106e3d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Nov 29 09:45:22 2013 +0000

    Replace strndup(), OS/X doesn't have it.

diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 1ea0348..5cce3e9 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -201,8 +201,10 @@ vsc_f_arg(struct VSM_data *vd, const char *opt)
 			if (*q == '\\')
 				q++;
 		if (i < 3) {
-			parts[i] = strndup(p, q - p);
+			parts[i] = malloc(1 + q - p);
 			AN(parts[i]);
+			memcpy(parts[i], p, q - p);
+			parts[i][q - p] = '\0';
 			p = r = parts[i];
 
 			/* Unescape */




More information about the varnish-commit mailing list