summaryrefslogtreecommitdiff
path: root/x11/XmHTML/patches/patch-ai
blob: a87a7a815ae5b2b282fc9c4e902d69c15d22b67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-ai,v 1.1 2005/10/03 17:52:10 joerg Exp $

--- lib/common/debug.c.orig	2005-08-16 19:40:17.000000000 +0000
+++ lib/common/debug.c
@@ -110,7 +110,7 @@ int debug_disable_warnings = 0;
 /*** Private Function Prototype Declarations ****/
 
 /*** Private Variable Declarations ***/
-static FILE *__rsd_debug_file = stdout;
+static FILE *__rsd_debug_file = NULL;
 
 /*****
 * When debug output is send to a file, we register an exit func to close
@@ -128,7 +128,8 @@ __rsd_at_exit(void)
 #endif
 {
 	/* close output file */
-	fclose(__rsd_debug_file);
+	if (__rsd_debug_file != NULL)
+		fclose(__rsd_debug_file);
 }
 
 /*****
@@ -159,6 +160,9 @@ __rsd_fprintf(fmt, va_alist)
 	va_start(arg_list);
 #endif /* __STDC__ */
 
+	if (__rsd_debug_file == NULL)
+		__rsd_debug_file = stdout;
+
 	/* flush to file */
 	vfprintf(__rsd_debug_file, fmt, arg_list);
 	va_end(arg_list);
@@ -298,7 +302,7 @@ __rsd_setDebugLevels(int *argc, char **a
 				if((chPtr = strstr(argv[i], ":")) != NULL)
 				{
 					/* close any existing output file */
-					if(__rsd_debug_file != stdout)
+					if(__rsd_debug_file != stdout && __rsd_debug_file != NULL)
 						fclose(__rsd_debug_file);
 
 					chPtr++;	/* skip : */