]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 671: don't use va_copy as it's not portable
authorLee Howard <faxguy@howardsilvan.com>
Sat, 30 Jul 2005 01:04:32 +0000 (01:04 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Sat, 30 Jul 2005 01:04:32 +0000 (01:04 +0000)
         this approach uses vsnprintf instead

CHANGES
util/FaxClient.c++

diff --git a/CHANGES b/CHANGES
index 29ff88ec38af3a978cb7af0a776d98e4c9ca14c7..bbab69fe1e55438a7e119b06630b88c86b7c2082 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,7 @@ Changelog for HylaFAX 4.2.2
 * fix potential hang on detecting an ECM block end (29 Jul 2005)
 * fix job batches to properly release modems (26 Jul 2005)
 * fix build error with Mac OS X 10.4 (26 Jul 2005)
-* fix sendfax crash with verbose output (25 Jul 2005)
+* fix sendfax crash with verbose output (25, 29 Jul 2005)
 * fix a race with scheduled jobs to allow for coordinated
   batch sending (25 Jul 2005)
 * fix some error conditions with JBIG and JPEG reception (25 Jul 2005)
index a2af87db4c412e200526cde9b565c17a5b0c7444..67f821edb0aab5e79129af397c80d1ef188ecd83 100644 (file)
@@ -617,18 +617,21 @@ FaxClient::command(const char* fmt ...)
 int
 FaxClient::vcommand(const char* fmt, va_list ap)
 {
+    char *line = NULL;
+
     if (getVerbose()) {
         if (strncasecmp("PASS ", fmt, 5) == 0) {
             traceServer("-> PASS XXXX");
         } else if (strncasecmp("ADMIN ", fmt, 6) == 0) {
             traceServer("-> ADMIN XXXX");
         } else {
-           va_list ap2;
-            fxStr s("-> ");
-            s.append(fmt);
-           va_copy(ap2, ap);
-            vtraceServer(s, ap2);
-           va_end(ap2);
+           line = (char *)malloc(100);
+           if (line == NULL)
+               printError("Memory allocation failed");
+           else {
+               vsnprintf(line, 100, fmt, ap);
+               traceServer("-> %s", line);
+           }
         }
     }
     if (fdOut == NULL) {
@@ -636,7 +639,12 @@ FaxClient::vcommand(const char* fmt, va_list ap)
         code = -1;
         return (0);
     }
-    vfprintf(fdOut, fmt, ap);
+    if (line == NULL)
+       vfprintf(fdOut, fmt, ap);
+    else {
+       fputs(line, fdOut);
+       free(line);
+    }
     fputs("\r\n", fdOut);
     (void) fflush(fdOut);
     return (getReply(strncmp(fmt, "QUIT", 4) == 0));