diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-01-03 12:29:55 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-01-03 12:29:55 +0800 |
commit | cb7febd0d1147cd307db61ab4ef8fdd46ca87239 (patch) | |
tree | eb73e3557adc66bec67d25a0155148d2d74acc37 | |
parent | 136b073b7913f2e3473293636482be5951ecad6c (diff) | |
download | marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar.gz marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar.bz2 marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar.lz marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar.xz marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.tar.zst marcuscom-ports-cb7febd0d1147cd307db61ab4ef8fdd46ca87239.zip |
* Don't use SOCK_STREAM when SOCK_DGRAM will do
* Fix a potential memory leak
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@1582 df743ca5-7f9a-e211-a948-0013205c9059
-rw-r--r-- | net/gnome-netstatus/Makefile | 1 | ||||
-rw-r--r-- | net/gnome-netstatus/files/patch-src_netstatus-iface.c | 15 | ||||
-rw-r--r-- | net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c | 5 | ||||
-rw-r--r-- | net/gnomenetstatus/Makefile | 1 | ||||
-rw-r--r-- | net/gnomenetstatus/files/patch-src_netstatus-iface.c | 15 | ||||
-rw-r--r-- | net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c | 5 |
6 files changed, 20 insertions, 22 deletions
diff --git a/net/gnome-netstatus/Makefile b/net/gnome-netstatus/Makefile index b7b8ddc66..4c5494cb6 100644 --- a/net/gnome-netstatus/Makefile +++ b/net/gnome-netstatus/Makefile @@ -7,6 +7,7 @@ PORTNAME= gnomenetstatus PORTVERSION= 0.12 +PORTREVISION= 1 CATEGORIES= net gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/gnome-netstatus/0.12 diff --git a/net/gnome-netstatus/files/patch-src_netstatus-iface.c b/net/gnome-netstatus/files/patch-src_netstatus-iface.c index 87a75d3db..f33269915 100644 --- a/net/gnome-netstatus/files/patch-src_netstatus-iface.c +++ b/net/gnome-netstatus/files/patch-src_netstatus-iface.c @@ -1,5 +1,5 @@ --- src/netstatus-iface.c.orig Fri Oct 31 08:49:51 2003 -+++ src/netstatus-iface.c Sat Dec 6 01:17:12 2003 ++++ src/netstatus-iface.c Fri Jan 2 23:29:27 2004 @@ -32,9 +32,12 @@ #include <libgnome/gnome-i18n.h> @@ -51,7 +51,7 @@ } gboolean -@@ -1083,10 +1095,13 @@ +@@ -1083,8 +1095,11 @@ struct ifconf *if_conf; GList *interfaces; GList *loopbacks; @@ -62,11 +62,8 @@ + int len; + gboolean loopback; -- if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) -+ if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) + if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - if (error) - *error = g_error_new (NETSTATUS_ERROR, @@ -1105,12 +1120,25 @@ interfaces = NULL; loopbacks = NULL; @@ -83,8 +80,7 @@ + if (if_req->ifr_addr.sa_len > len) + len = if_req->ifr_addr.sa_len; +#endif - -- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0) ++ + ptr += sizeof(if_req->ifr_name) + len; + + if (g_list_find_custom (interfaces, if_req->ifr_name, @@ -92,7 +88,8 @@ + || g_list_find_custom (loopbacks, if_req->ifr_name, + (GCompareFunc) g_ascii_strcasecmp) != NULL) + continue; -+ + +- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0) + if (ioctl (fd, SIOCGIFFLAGS, if_req) < 0) { if (error) diff --git a/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c b/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c index 5b80d1865..3598a24e6 100644 --- a/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c +++ b/net/gnome-netstatus/files/patch-src_netstatus-sysdeps.c @@ -1,5 +1,5 @@ --- src/netstatus-sysdeps.c.orig Mon Jun 9 13:18:04 2003 -+++ src/netstatus-sysdeps.c Sat Dec 6 17:25:49 2003 ++++ src/netstatus-sysdeps.c Fri Jan 2 23:29:16 2004 @@ -27,10 +27,13 @@ #include <stdio.h> @@ -31,7 +31,7 @@ static inline FILE * get_proc_net_dev_fh (void) { -@@ -206,3 +212,125 @@ +@@ -206,3 +212,126 @@ return error_message; } @@ -145,6 +145,7 @@ + close (pout); + } + else { ++ g_strfreev (command_line); + if (error_message) + g_free (error_message); + error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s", diff --git a/net/gnomenetstatus/Makefile b/net/gnomenetstatus/Makefile index b7b8ddc66..4c5494cb6 100644 --- a/net/gnomenetstatus/Makefile +++ b/net/gnomenetstatus/Makefile @@ -7,6 +7,7 @@ PORTNAME= gnomenetstatus PORTVERSION= 0.12 +PORTREVISION= 1 CATEGORIES= net gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/gnome-netstatus/0.12 diff --git a/net/gnomenetstatus/files/patch-src_netstatus-iface.c b/net/gnomenetstatus/files/patch-src_netstatus-iface.c index 87a75d3db..f33269915 100644 --- a/net/gnomenetstatus/files/patch-src_netstatus-iface.c +++ b/net/gnomenetstatus/files/patch-src_netstatus-iface.c @@ -1,5 +1,5 @@ --- src/netstatus-iface.c.orig Fri Oct 31 08:49:51 2003 -+++ src/netstatus-iface.c Sat Dec 6 01:17:12 2003 ++++ src/netstatus-iface.c Fri Jan 2 23:29:27 2004 @@ -32,9 +32,12 @@ #include <libgnome/gnome-i18n.h> @@ -51,7 +51,7 @@ } gboolean -@@ -1083,10 +1095,13 @@ +@@ -1083,8 +1095,11 @@ struct ifconf *if_conf; GList *interfaces; GList *loopbacks; @@ -62,11 +62,8 @@ + int len; + gboolean loopback; -- if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) -+ if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) + if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - if (error) - *error = g_error_new (NETSTATUS_ERROR, @@ -1105,12 +1120,25 @@ interfaces = NULL; loopbacks = NULL; @@ -83,8 +80,7 @@ + if (if_req->ifr_addr.sa_len > len) + len = if_req->ifr_addr.sa_len; +#endif - -- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0) ++ + ptr += sizeof(if_req->ifr_name) + len; + + if (g_list_find_custom (interfaces, if_req->ifr_name, @@ -92,7 +88,8 @@ + || g_list_find_custom (loopbacks, if_req->ifr_name, + (GCompareFunc) g_ascii_strcasecmp) != NULL) + continue; -+ + +- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0) + if (ioctl (fd, SIOCGIFFLAGS, if_req) < 0) { if (error) diff --git a/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c b/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c index 5b80d1865..3598a24e6 100644 --- a/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c +++ b/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c @@ -1,5 +1,5 @@ --- src/netstatus-sysdeps.c.orig Mon Jun 9 13:18:04 2003 -+++ src/netstatus-sysdeps.c Sat Dec 6 17:25:49 2003 ++++ src/netstatus-sysdeps.c Fri Jan 2 23:29:16 2004 @@ -27,10 +27,13 @@ #include <stdio.h> @@ -31,7 +31,7 @@ static inline FILE * get_proc_net_dev_fh (void) { -@@ -206,3 +212,125 @@ +@@ -206,3 +212,126 @@ return error_message; } @@ -145,6 +145,7 @@ + close (pout); + } + else { ++ g_strfreev (command_line); + if (error_message) + g_free (error_message); + error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s", |