]> git.sesse.net Git - vlc/commitdiff
Log dangerous registration of signal handlers
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Apr 2010 15:37:52 +0000 (18:37 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 11 Apr 2010 15:39:42 +0000 (18:39 +0300)
bin/override.c

index 2f7606ba56367fc9964afced6a24a1f50c894700..1eabda0135b5efa9edec3a727d3f349f68993794 100644 (file)
@@ -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__ */