]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Fix up variable argument handling around vfprintf's.
authorTim Shimmin <tes@sgi.com>
Fri, 6 Oct 2006 16:19:47 +0000 (16:19 +0000)
committerTim Shimmin <tes@sgi.com>
Fri, 6 Oct 2006 16:19:47 +0000 (16:19 +0000)
Crashing on x86_64 otherwise and is just plain wrong.
Merge of master-melb:xfs-cmds:27143a by kenmcd.

  Fix up variable argument handling around vfprintf's.
  Crashing on x86_64 otherwise and is just plain wrong.

copy/xfs_copy.c

index adeb60a91b705e53e8a1b31c5e542d4b63135242..7795e8a8fa10a261421e482d78bddd9798f4e669 100644 (file)
@@ -77,17 +77,23 @@ do_message(int flags, int code, const char *fmt, ...)
        va_list ap;
        int     eek = 0;
 
-       va_start(ap, fmt);
-       if (flags & LOG)
+       if (flags & LOG) {
+               va_start(ap, fmt);
                if (vfprintf(logerr, fmt, ap) <= 0)
                        eek = 1;
+               va_end(ap);
+       }
        if (eek)
                flags |= ERR;   /* failed, force stderr */
-       if (flags & ERR)
+       if (flags & ERR) {
+               va_start(ap, fmt);
                vfprintf(stderr, fmt, ap);
-       else if (flags & OUT)
+               va_end(ap);
+       } else if (flags & OUT) {
+               va_start(ap, fmt);
                vfprintf(stdout, fmt, ap);
-       va_end(ap);
+               va_end(ap);
+       }
 
        if (flags & PRE) {
                do_message(flags & ~PRE, 0, ":  %s\n", strerror(code));