aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2007-11-05 19:22:10 +0800
committermiwi <miwi@FreeBSD.org>2007-11-05 19:22:10 +0800
commitd7ffd4b44aa7dfe32e6651e010b5dc433a4f0376 (patch)
tree59044a08ab04f9fabcf9f75dd459f5e1425cb5b4 /misc
parenta69966bfb11ddb7085bc0eeee721942e5441ee23 (diff)
downloadfreebsd-ports-gnome-d7ffd4b44aa7dfe32e6651e010b5dc433a4f0376.tar.gz
freebsd-ports-gnome-d7ffd4b44aa7dfe32e6651e010b5dc433a4f0376.tar.zst
freebsd-ports-gnome-d7ffd4b44aa7dfe32e6651e010b5dc433a4f0376.zip
- Fix refreshing weather data
PR: 117741 Submitted by: Iulian Margarintescu <eti@erata.net> Approved by: portmgr (pav) Obtained from: OpenBSD ports
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;
+ }
+
+