gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. 4c90f189d18dc6470c71


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 4c90f189d18dc6470c71e40317efb14565051c4a
Date: Thu, 21 Oct 2010 14:46:45 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  4c90f189d18dc6470c71e40317efb14565051c4a (commit)
       via  2e74fddfc73324b15e479ecd66138a7e2cbc96d2 (commit)
      from  ba71eb64502c79a082c03c5850a4b41f91996352 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=4c90f189d18dc6470c71e40317efb14565051c4a


commit 4c90f189d18dc6470c71e40317efb14565051c4a
Merge: 2e74fdd ba71eb6
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 21 16:46:37 2010 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=2e74fddfc73324b15e479ecd66138a7e2cbc96d2


commit 2e74fddfc73324b15e479ecd66138a7e2cbc96d2
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 21 16:45:03 2010 +0200

    Make less fuss about setting signals, and fix w32 build.

diff --git a/libbase/Socket.cpp b/libbase/Socket.cpp
index 9abce0f..7d5e19e 100644
--- a/libbase/Socket.cpp
+++ b/libbase/Socket.cpp
@@ -37,13 +37,6 @@ namespace {
 #include "utility.h"
 #include "GnashAlgorithm.h"
 
-/*
-  TODO: use sigaction();
- */
-#ifndef sighandler_t
-       typedef void (*sighandler_t)(int);
-#endif
-
 namespace gnash {
 
 Socket::Socket()
@@ -328,9 +321,21 @@ Socket::write(const void* src, std::streamsize num)
 
     const char* buf = static_cast<const char*>(src);
 
+#ifndef _WIN32
+    // Prevent sigpipe (which isn't a standard C signal)
+    // until leaving this function.
+    const struct SignalSetter
+    {
+        typedef void(*SigHandler)(int);
+        SignalSetter() : _h(std::signal(SIGPIPE, SIG_IGN)) {}
+        ~SignalSetter() { std::signal(SIGPIPE, _h); }
+    private:
+        const SigHandler _h;
+    } setter;
+#endif
+
     // For broken pipe we prefer being notified with
     // a return of -1 from ::send.
-    sighandler_t oldSig = std::signal(SIGPIPE, SIG_IGN);
 
     while (toWrite > 0) {
         bytesSent = ::send(_socket, buf, toWrite, 0);
@@ -338,7 +343,6 @@ Socket::write(const void* src, std::streamsize num)
             const int err = errno;
             log_error("Socket send error %s", std::strerror(err));
             _error = true;
-            std::signal(SIGPIPE, oldSig);
             return 0;
         }
 
@@ -346,7 +350,6 @@ Socket::write(const void* src, std::streamsize num)
         toWrite -= bytesSent;
         buf += bytesSent;
     }
-    std::signal(SIGPIPE, oldSig);
     return num - toWrite;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 libbase/Socket.cpp |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]