diff options
author | Dan Winship <danw@src.gnome.org> | 2008-04-05 14:09:40 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2008-04-05 14:09:40 +0000 |
commit | b32b17ce04118a7c06ab0cb1d0066cf9cef19e4d (patch) | |
tree | cdad011dbe58ad43e4b442a9e5bb643013757bd2 | |
parent | 060b86b7d13cff079fb51548971b72bf9065a01e (diff) | |
download | libsoup-b32b17ce04118a7c06ab0cb1d0066cf9cef19e4d.tar.gz |
globally ignore SIGPIPE rather than only doing it around socket write
* libsoup/soup-socket.c (soup_socket_class_init)
(soup_socket_write): globally ignore SIGPIPE rather than only
doing it around socket write calls, since with SSL even socket
read calls may need to write, and also because SIGPIPE is
completely moronic and no one should be using it, and the previous
"solution" wasn't thread-safe anyway. Fixes #524397, reported by
Curtis Magyar.
svn path=/trunk/; revision=1124
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | libsoup/soup-socket.c | 13 |
2 files changed, 14 insertions, 9 deletions
@@ -1,5 +1,15 @@ 2008-04-05 Dan Winship <danw@gnome.org> + * libsoup/soup-socket.c (soup_socket_class_init) + (soup_socket_write): globally ignore SIGPIPE rather than only + doing it around socket write calls, since with SSL even socket + read calls may need to write, and also because SIGPIPE is + completely moronic and no one should be using it, and the previous + "solution" wasn't thread-safe anyway. Fixes #524397, reported by + Curtis Magyar. + +2008-04-05 Dan Winship <danw@gnome.org> + Misc fixes noticed by "sparse" or by running gcc with additional -W flags diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c index fdf8d375..b1c2252a 100644 --- a/libsoup/soup-socket.c +++ b/libsoup/soup-socket.c @@ -162,6 +162,10 @@ soup_socket_class_init (SoupSocketClass *socket_class) { GObjectClass *object_class = G_OBJECT_CLASS (socket_class); +#ifdef SIGPIPE + signal (SIGPIPE, SIG_IGN); +#endif + g_type_class_add_private (socket_class, sizeof (SoupSocketPrivate)); /* virtual method override */ @@ -1297,9 +1301,6 @@ soup_socket_write (SoupSocket *sock, gconstpointer buffer, { SoupSocketPrivate *priv; GIOStatus status; -#ifdef SIGPIPE - gpointer pipe_handler; -#endif GIOCondition cond = G_IO_OUT; GError *my_err = NULL; @@ -1319,14 +1320,8 @@ soup_socket_write (SoupSocket *sock, gconstpointer buffer, return SOUP_SOCKET_WOULD_BLOCK; } -#ifdef SIGPIPE - pipe_handler = signal (SIGPIPE, SIG_IGN); -#endif status = g_io_channel_write_chars (priv->iochannel, buffer, len, nwrote, &my_err); -#ifdef SIGPIPE - signal (SIGPIPE, pipe_handler); -#endif if (my_err) { if (my_err->domain == SOUP_SSL_ERROR && my_err->code == SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ) |