public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* review: xfs_copy fix
@ 2006-10-06  6:18 Timothy Shimmin
  2006-10-06  6:36 ` David Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Timothy Shimmin @ 2006-10-06  6:18 UTC (permalink / raw)
  To: xfs-dev; +Cc: xfs

Request for review.

xfs_copy was seg faulting for me on my x86_64 box.
This fixes up the variable arg handling for multiple
vfprintf calls by putting va_start and va_end calls
around them (never done this before:).

Thanks,
--Tim


===========================================================================
Index: xfs-cmds/xfsprogs/copy/xfs_copy.c
===================================================================
--- xfs-cmds.orig/xfsprogs/copy/xfs_copy.c	2006-10-06 13:55:01.000000000 
+1000
+++ xfs-cmds/xfsprogs/copy/xfs_copy.c	2006-10-06 13:52:14.000000000 +1000
@@ -77,17 +77,23 @@
 	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));

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-06  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-06  6:18 review: xfs_copy fix Timothy Shimmin
2006-10-06  6:36 ` David Chinner
2006-10-06  7:15   ` Timothy Shimmin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox