Alexandre Julliard : libwine: Disable debug output when stderr goes to /dev /null.
Alexandre Julliard
julliard at winehq.org
Mon Sep 5 13:26:19 CDT 2011
Module: wine
Branch: master
Commit: 794b9313a4ba288273f38a9d9d4de021af3e96fe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=794b9313a4ba288273f38a9d9d4de021af3e96fe
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sun Sep 4 23:08:10 2011 +0200
libwine: Disable debug output when stderr goes to /dev/null.
---
libs/wine/debug.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libs/wine/debug.c b/libs/wine/debug.c
index 12dbeb8..a38abf4 100644
--- a/libs/wine/debug.c
+++ b/libs/wine/debug.c
@@ -26,6 +26,9 @@
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
#include "wine/debug.h"
#include "wine/library.h"
@@ -186,9 +189,19 @@ static void debug_usage(void)
static void debug_init(void)
{
char *wine_debug;
+ struct stat st1, st2;
if (nb_debug_options != -1) return; /* already initialized */
nb_debug_options = 0;
+
+ /* check for stderr pointing to /dev/null */
+ if (!fstat( 2, &st1 ) && S_ISCHR(st1.st_mode) &&
+ !stat( "/dev/null", &st2 ) && S_ISCHR(st2.st_mode) &&
+ st1.st_rdev == st2.st_rdev)
+ {
+ default_flags = 0;
+ return;
+ }
if ((wine_debug = getenv("WINEDEBUG")))
{
if (!strcmp( wine_debug, "help" )) debug_usage();
More information about the wine-cvs
mailing list