1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-03 06:04:53 +00:00

- Fix build for OSVERSION < 702000

PR:		ports/151762
Submitted by:	"Pawel Pekala" <c0rn@o2.pl> (maintainer)
This commit is contained in:
Wen Heping 2010-10-27 01:07:27 +00:00
parent 59fe6b0543
commit dfb2cd50ee
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=263635
2 changed files with 23 additions and 1 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= upnp
PORTVERSION= 1.6.8
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= devel
MASTER_SITES= SF/p${PORTNAME}/p${PORTNAME}/libUPnP%20${PORTVERSION}
@ -38,4 +39,11 @@ post-patch: .SILENT
${REINPLACE_CMD} '/^pkgconfigexecdir/s|$$(libdir)|$$(prefix)/libdata|' \
${WRKSRC}/Makefile.in
.include <bsd.port.mk>
.include <bsd.port.pre.mk>
# strndup(3) was added in 7.2-RELEASE
.if ${OSVERSION} < 702000
EXTRA_PATCHES+= ${FILESDIR}/extra-upnp-src-api-UpnpString.c
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,14 @@
--- upnp/src/api/UpnpString.c.orig 2010-10-26 21:46:15.000000000 +0200
+++ upnp/src/api/UpnpString.c 2010-10-26 21:51:47.000000000 +0200
@@ -165,8 +165,10 @@
int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n)
{
- char *q = strndup(s, n);
+ char *q = malloc(n+1);
if (!q) goto error_handler1;
+ strncpy(q, s, n);
+ q[n-1] = '\0';
free(((struct SUpnpString *)p)->m_string);
((struct SUpnpString *)p)->m_length = strlen(q);
((struct SUpnpString *)p)->m_string = q;