[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [master] eec5e98 Replace strndup(), OS/X doesn't have it.
From:       Poul-Henning Kamp <phk () FreeBSD ! org>
Date:       2013-11-29 9:46:09
Message-ID: E1VmKeH-0007OH-5a () project ! varnish-software ! com
[Download RAW message or body]


commit eec5e98e73fcbd3816e27dc0ac568a57e6106e3d
Author: Poul-Henning Kamp <phk@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 */


_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic