[vlc-commits] commit: VLC: remove false positives after fork() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun Apr 11 18:23:21 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 11 19:22:24 2010 +0300| [0194cf13b49fe6166152d427bcb06f5b25d197a6] | committer: Rémi Denis-Courmont 

VLC: remove false positives after fork()

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

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

diff --git a/bin/override.c b/bin/override.c
index c98ff81..c6084d8 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -26,13 +26,6 @@
 
 void vlc_enable_override (void);
 
-static bool override = false;
-
-void vlc_enable_override (void)
-{
-    override = true;
-}
-
 #if defined (__GNUC__) /* typeof and statement-expression */ \
  && (defined (__ELF__) && !defined (__sun__))
 /* Solaris crashes on printf("%s", NULL); which is legal, but annoying. */
@@ -46,6 +39,19 @@ void vlc_enable_override (void)
 # include <execinfo.h>
 #endif
 
+static bool override = false;
+
+static void vlc_reset_override (void)
+{
+    override = false;
+}
+
+void vlc_enable_override (void)
+{
+    override = true;
+    pthread_atfork (NULL, NULL, vlc_reset_override);
+}
+
 static void vlogbug (const char *level, const char *func, const char *fmt,
                      va_list ap)
 {
@@ -186,4 +192,8 @@ int sigaction (int signum, const struct sigaction *act, struct sigaction *old)
 }
 
 
-#endif /* __ELF__ */
+#else
+static void vlc_enable_override (void)
+{
+}
+#endif



More information about the vlc-commits mailing list