1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-23 20:51:43 +00:00

Be a little more sensible when allocating memory to hold the netstat tokens.

This commit is contained in:
Joe Marcus Clarke 2004-07-06 05:23:00 +00:00
parent e43640bbfa
commit c10f8a540c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=113034
4 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= gnomenettool
PORTVERSION= 0.99.1
PORTREVISION= 1
CATEGORIES= net gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-nettool/0.99

View File

@ -1,5 +1,5 @@
--- src/info.c.orig Fri Jun 11 07:14:17 2004
+++ src/info.c Mon Jul 5 15:25:09 2004
+++ src/info.c Tue Jul 6 01:19:20 2004
@@ -37,6 +37,9 @@
#include <sys/ioctl.h>
#include <stdlib.h>
@ -132,7 +132,7 @@
compressed, multicast,
tx_bytes, tx_pkt, tx_error, tx_drop, tx_fifo, collissions);
+#elif defined(__FreeBSD__)
+ tokens = (gchar **) g_malloc0 ((sizeof (char)) * (strlen (line) + 2));
+ tokens = (gchar **) g_malloc0 (sizeof (gchar *) * 12);
+ p = strtok (line, " \t\n");
+ /* We only care about 11 fields for now */
+ for (i = 0; i < 11 && p; i++, p = strtok (NULL, " \t\n")) {

View File

@ -7,6 +7,7 @@
PORTNAME= gnomenettool
PORTVERSION= 0.99.1
PORTREVISION= 1
CATEGORIES= net gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-nettool/0.99

View File

@ -1,5 +1,5 @@
--- src/info.c.orig Fri Jun 11 07:14:17 2004
+++ src/info.c Mon Jul 5 15:25:09 2004
+++ src/info.c Tue Jul 6 01:19:20 2004
@@ -37,6 +37,9 @@
#include <sys/ioctl.h>
#include <stdlib.h>
@ -132,7 +132,7 @@
compressed, multicast,
tx_bytes, tx_pkt, tx_error, tx_drop, tx_fifo, collissions);
+#elif defined(__FreeBSD__)
+ tokens = (gchar **) g_malloc0 ((sizeof (char)) * (strlen (line) + 2));
+ tokens = (gchar **) g_malloc0 (sizeof (gchar *) * 12);
+ p = strtok (line, " \t\n");
+ /* We only care about 11 fields for now */
+ for (i = 0; i < 11 && p; i++, p = strtok (NULL, " \t\n")) {