summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2007-11-05 11:22:10 +0000
committerMartin Wilke <miwi@FreeBSD.org>2007-11-05 11:22:10 +0000
commit655e14af0984bbafcf2a365e436a84d118d4c672 (patch)
tree5003b35ee2733def67a1dd72f7010df4ad0e0d37 /misc
parent- Fix build with gcc 4.2 (diff)
- Fix refreshing weather data
PR: 117741 Submitted by: Iulian Margarintescu <eti@erata.net> Approved by: portmgr (pav) Obtained from: OpenBSD ports
Notes
Notes: svn path=/head/; revision=202519
Diffstat (limited to 'misc')
-rw-r--r--misc/xfce4-weather-plugin/Makefile2
-rw-r--r--misc/xfce4-weather-plugin/files/patch-panel-plugin_weather-http.c69
2 files changed, 70 insertions, 1 deletions
diff --git a/misc/xfce4-weather-plugin/Makefile b/misc/xfce4-weather-plugin/Makefile
index e20e61da4ff4..fa772eeda18d 100644
--- a/misc/xfce4-weather-plugin/Makefile
+++ b/misc/xfce4-weather-plugin/Makefile
@@ -7,7 +7,7 @@
PORTNAME= xfce4-weather-plugin
PORTVERSION= 0.6.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= misc xfce geography
MASTER_SITES= http://goodies.xfce.org/releases/${PORTNAME}/
DIST_SUBDIR= xfce4
diff --git a/misc/xfce4-weather-plugin/files/patch-panel-plugin_weather-http.c b/misc/xfce4-weather-plugin/files/patch-panel-plugin_weather-http.c
new file mode 100644
index 000000000000..f8be3fdeedf2
--- /dev/null
+++ b/misc/xfce4-weather-plugin/files/patch-panel-plugin_weather-http.c
@@ -0,0 +1,69 @@
+--- panel-plugin/weather-http.c.orig Wed Jan 17 19:02:39 2007
++++ panel-plugin/weather-http.c Mon May 14 17:04:58 2007
+@@ -83,14 +83,61 @@ http_connect (gchar *hostname,
+ fcntl (fd, F_SETFL, O_NONBLOCK);
+
+ if ((connect (fd, (struct sockaddr *) &dest_host, sizeof (struct sockaddr))
+- == -1) && errno != EINPROGRESS)
++ == -1))
+ {
+- perror ("http_connect()");
+- return -1;
++ gboolean failed = TRUE;
++
++ if(errno == EWOULDBLOCK || errno == EINPROGRESS || errno == EALREADY)
++ {
++ gint iters_left;
++ for(iters_left = 5; iters_left >= 0; iters_left--) {
++ fd_set wfd;
++ struct timeval tv = { 2, 0 };
++ int sock_err = 0;
++ socklen_t sock_err_len = sizeof(int);
++
++ FD_ZERO(&wfd);
++ FD_SET(fd, &wfd);
++
++ DBG("checking for a connection...");
++
++ /* wait until the connect attempt finishes */
++ if(select(FD_SETSIZE, NULL, &wfd, NULL, &tv) < 0)
++ break;
++
++ /* check to see if it finished, and, if so, if there was an
++ * error, or if it completed successfully */
++ if(FD_ISSET(fd, &wfd)) {
++ if(!getsockopt(fd, SOL_SOCKET, SO_ERROR,
++ &sock_err, &sock_err_len)
++ && !sock_err)
++ {
++ DBG(" connection succeeded");
++ failed = FALSE;
++ } else {
++ g_warning(" connection failed");
++ DBG(" connection failed: sock_err is %d", sock_err);
++ }
++ break;
++ }
++ }
++ }
++
++ if(failed)
++ {
++ DBG("failed to connect");
++ close(fd);
++ fd = -1;
++ perror ("http_connect()");
++ return -1;
++ }
+ }
+- else
+- return fd;
++
++ if(fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~(O_NONBLOCK))) {
++ g_warning("Unable to return socket to blocking mode.");
++ }
+
++ return fd;
+ }
+
+