[vlc-commits] commit: Log dangerous registration of signal handlers ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun Apr 11 17:40:14 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 11 18:37:52 2010 +0300| [2eb05547c95e390ecab9f047beb7c4098f656ff2] | committer: Rémi Denis-Courmont 

Log dangerous registration of signal handlers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2eb05547c95e390ecab9f047beb7c4098f656ff2
---

 bin/override.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/bin/override.c b/bin/override.c
index 2f7606b..1eabda0 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -147,4 +147,30 @@ int rand (void)
 }
 
 
+/** Signals **/
+#include <signal.h>
+
+void (*signal (int signum, void (*handler) (int))) (int)
+{
+    if (override)
+    {
+        const char *msg = "Error";
+
+        if ((signum == SIGPIPE && handler == SIG_IGN)
+         || (signum != SIGPIPE && handler == SIG_DFL))
+            /* Same settings we already use */
+            msg = "Warning";
+        LOG(msg, "%d, %p", signum, handler);
+    }
+    return CALL(signal, signum, handler);
+}
+
+int sigaction (int signum, const struct sigaction *act, struct sigaction *old)
+{
+    if (act != NULL)
+        LOG("Error", "%d, %p, %p", signum, act, old);
+    return CALL(sigaction, signum, act, old);
+}
+
+
 #endif /* __ELF__ */



More information about the vlc-commits mailing list