Browse Source

cmErr.c: Fix bug in use of va_list which showed up on spat-lab Mac port.

master
kevin 11 years ago
parent
commit
73b2d853c8
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      cmErr.c

+ 6
- 1
cmErr.c View File

17
 {
17
 {
18
   if( err->rpt == NULL )
18
   if( err->rpt == NULL )
19
     return;
19
     return;
20
+ 
21
+  va_list vl0;
22
+  va_copy(vl0,vl);
20
 
23
 
21
   const cmChar_t* hdrFmt = warnFl ? "%s warning: " : "%s error: ";
24
   const cmChar_t* hdrFmt = warnFl ? "%s warning: " : "%s error: ";
22
   const cmChar_t* codeFmt = " (RC:%i)";
25
   const cmChar_t* codeFmt = " (RC:%i)";
26
   int        n2 = snprintf( NULL,0,codeFmt,rc);
29
   int        n2 = snprintf( NULL,0,codeFmt,rc);
27
   int        n  = n0+n1+n2+1;
30
   int        n  = n0+n1+n2+1;
28
   cmChar_t s[n];
31
   cmChar_t s[n];
32
+
29
   n0 =  snprintf(s,n,hdrFmt,cmStringNullGuard(err->label));
33
   n0 =  snprintf(s,n,hdrFmt,cmStringNullGuard(err->label));
30
-  n0 += vsnprintf(s+n0,n-n0,fmt,vl);
34
+  n0 += vsnprintf(s+n0,n-n0,fmt,vl0);
31
   n0 += snprintf(s+n0,n-n0,codeFmt,rc);
35
   n0 += snprintf(s+n0,n-n0,codeFmt,rc);
32
   assert(n0 <= n );
36
   assert(n0 <= n );
33
   cmRptErrorf(err->rpt,"%s\n",s);
37
   cmRptErrorf(err->rpt,"%s\n",s);
38
+  va_end(vl0);
34
 }
39
 }
35
 
40
 
36
 void _cmErrMsg( cmErr_t* err, bool warnFl, cmRC_t rc, const cmChar_t* fmt, ... )
41
 void _cmErrMsg( cmErr_t* err, bool warnFl, cmRC_t rc, const cmChar_t* fmt, ... )

Loading…
Cancel
Save