diff options
author | dwcjr <dwcjr@FreeBSD.org> | 2001-09-14 11:13:16 +0800 |
---|---|---|
committer | dwcjr <dwcjr@FreeBSD.org> | 2001-09-14 11:13:16 +0800 |
commit | 0d2a415a1fff880d33872c5e7d18687839cbfa70 (patch) | |
tree | d9a31733ad72428685e40e61309016ced01276bd /net/netatalk | |
parent | 9d949c54d07fbc8c4b1444724c9d34b77c261035 (diff) | |
download | freebsd-ports-gnome-0d2a415a1fff880d33872c5e7d18687839cbfa70.tar.gz freebsd-ports-gnome-0d2a415a1fff880d33872c5e7d18687839cbfa70.tar.zst freebsd-ports-gnome-0d2a415a1fff880d33872c5e7d18687839cbfa70.zip |
Fix malloc bug when config file does not exist
Bump PORTREVISION
PR: 30566
Submitted by: maintainer
Diffstat (limited to 'net/netatalk')
-rw-r--r-- | net/netatalk/Makefile | 6 | ||||
-rw-r--r-- | net/netatalk/files/patch-aj | 104 | ||||
-rw-r--r-- | net/netatalk/pkg-plist | 1 |
3 files changed, 108 insertions, 3 deletions
diff --git a/net/netatalk/Makefile b/net/netatalk/Makefile index b4e51a07dc1b..095e34a35108 100644 --- a/net/netatalk/Makefile +++ b/net/netatalk/Makefile @@ -7,7 +7,7 @@ PORTNAME= netatalk PORTVERSION= 1.5p7 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net print MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= netatalk @@ -59,14 +59,14 @@ MAN3= atalk_aton.3 nbp_name.3 MAN4= atalk.4 MAN5= AppleVolumes.default.5 afpd.conf.5 atalkd.conf.5 \ netatalk.conf.5 papd.conf.5 -MAN8= afpd.8 atalkd.8 pap.8 papd.8 papstatus.8 psf.8 +MAN8= afpd.8 atalkd.8 pap.8 papd.8 papstatus.8 psf.8 timelord.8 post-extract: @${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${FILESDIR}/netatalk.sh \ > ${WRKSRC}/netatalk.sh post-configure: - @${TOUCH} ${WRKSRC}/config/Makefile.in + @${TOUCH} -f ${WRKSRC}/config/Makefile.in post-install: @${RM} -f ${PREFIX}/bin/nu ${PREFIX}/bin/lp2pap.sh \ diff --git a/net/netatalk/files/patch-aj b/net/netatalk/files/patch-aj new file mode 100644 index 000000000000..55fd7d40340c --- /dev/null +++ b/net/netatalk/files/patch-aj @@ -0,0 +1,104 @@ +--- libatalk/util/getiface.c.orig Thu Sep 13 00:28:21 2001 ++++ libatalk/util/getiface.c Thu Sep 13 00:28:30 2001 +@@ -43,13 +43,6 @@ + { + /* if we've run out of room, allocate some more. just return + * the present list if we can't. */ +- if (*i >= *length) { +- char **new = realloc(list, sizeof(char **)*(*length + IFACE_NUM)); +- +- if (!new) /* just break if we can't allocate anything */ +- return -1; +- *length += IFACE_NUM; +- } + + if ((list[*i] = strdup(name)) == NULL) + return -1; +@@ -60,30 +53,32 @@ + } + + +-static int getifaces(const int sockfd, char **list, int *length) ++static int getifaces(const int sockfd, char ***list, int *length) + { + #ifdef HAVE_IFNAMEINDEX + struct if_nameindex *ifstart, *ifs; + int i = 0; ++ char **new; + +- if (!list || *length < 1) +- return 0; +- + ifs = ifstart = if_nameindex(); ++ ++ new = (char **) malloc((sizeof(ifs)/sizeof(struct if_nameindex) + 1) * sizeof(char *)); + while (ifs && ifs->if_name) { + /* just bail if there's a problem */ +- if (addname(list, &i, length, ifs->if_name) < 0) ++ if (addname(new, &i, length, ifs->if_name) < 0) + break; + ifs++; + } + + if_freenameindex(ifstart); ++ *list = new; + return i; + + #else + struct ifconf ifc; + struct ifreq ifrs[ 64 ], *ifr, *nextifr; + int ifrsize, i = 0; ++ char **new; + + if (!list || *length < 1) + return 0; +@@ -96,6 +91,7 @@ + return 0; + } + ++ new = (char **) malloc((ifc.ifc_len/sizeof(struct ifreq) + 1) * sizeof(char *)); + for ( ifr = ifc.ifc_req; ifc.ifc_len >= sizeof( struct ifreq ); + ifc.ifc_len -= ifrsize, ifr = nextifr ) { + #ifdef BSD4_4 +@@ -108,9 +104,10 @@ + nextifr = (struct ifreq *)((caddr_t)ifr + ifrsize ); + + /* just bail if there's a problem */ +- if (addname(list, &i, length, ifr->ifr_name) < 0) ++ if (addname(new, &i, length, ifr->ifr_name) < 0) + break; + } ++ *list = new; + return i; + #endif + } +@@ -122,17 +119,14 @@ + */ + char **getifacelist() + { +- char **list = (char **) malloc(sizeof(char **)*(IFACE_NUM + 1)); ++ char **list; + char **new; +- int length = IFACE_NUM, i, fd; ++ int length, i, fd; + +- if (!list) +- return NULL; +- + if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) + return NULL; + +- if ((i = getifaces(fd, list, &length)) == 0) { ++ if ((i = getifaces(fd, &list, &length)) == 0) { + free(list); + close(fd); + return NULL; +@@ -140,7 +134,7 @@ + close(fd); + + if ((i < length) && +- (new = (char **) realloc(list, sizeof(char **)*(i + 1)))) ++ (new = (char **) realloc(list, (i + 1) * sizeof(char *)))) + return new; + + return list; diff --git a/net/netatalk/pkg-plist b/net/netatalk/pkg-plist index 7e6ea5543c66..be7ece74b751 100644 --- a/net/netatalk/pkg-plist +++ b/net/netatalk/pkg-plist @@ -142,3 +142,4 @@ lib/libatalk.a lib/libatalk.la share/aclocal/netatalk.m4 share/netatalk/pagecount.ps +@dirrm share/netatalk |