summaryrefslogtreecommitdiff
path: root/net/mpd/files/patch-src::log.c
blob: 83d46e5b01b5f96e5b619338c70eaadf307c6bd5 (plain) (blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Index: src/log.c
===================================================================
RCS file: /cvsroot/mpd/mpd/src/log.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- src/log.c	25 Nov 2002 23:51:41 -0000	1.4
+++ src/log.c	7 Oct 2004 22:43:31 -0000	1.4.2.1
@@ -265,17 +265,21 @@
 {
   va_list	args;
 
-  va_start(args, fmt);
   LogTimeStamp(logprintf);
+  va_start(args, fmt);
   vlogprintf(fmt, args);
+  va_end(args);
+  va_start(args, fmt);
   vlogprintf("\n", args);		/* XXX args will be ignored */
+  va_end(args);
   if (gLogOptions & LG_CONSOLE)
   {
+    va_start(args, fmt);
     vfprintf(stdout, fmt, args);
+    va_end(args);
     putc('\n', stdout);
     fflush(stdout);
   }
-  va_end(args);
 }
 
 /*
@@ -315,12 +319,16 @@
 
 /* Dump it */
 
-  va_start(ap, fmt);
-  if (console)
+  if (console) {
+    va_start(ap, fmt);
     LogDoDumpBp(printf, vprintf, FALSE, bp, fmt, ap);
-  if (log)
+    va_end(ap);
+  }
+  if (log) {
+    va_start(ap, fmt);
     LogDoDumpBp(logprintf, vlogprintf, TRUE, bp, fmt, ap);
-  va_end(ap);
+    va_end(ap);
+  }
 }
 
 /*
@@ -342,11 +350,16 @@
 
 /* Dump it */
 
-  va_start(ap, fmt);
-  if (console)
+  if (console) {
+    va_start(ap, fmt);
     LogDoDumpBuf(printf, vprintf, FALSE, buf, count, fmt, ap);
-  if (log)
+    va_end(ap);
+  }
+  if (log) {
+    va_start(ap, fmt);
     LogDoDumpBuf(logprintf, vlogprintf, TRUE, buf, count, fmt, ap);
+    va_end(ap);
+  }
 }
 
 /*