[Ocfs2-tools-commits] zab commits r379 - in trunk/fsck.ocfs2: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Nov 9 13:50:04 CST 2004


Author: zab
Date: 2004-11-09 13:50:02 -0600 (Tue, 09 Nov 2004)
New Revision: 379

Modified:
   trunk/fsck.ocfs2/fsck.c
   trunk/fsck.ocfs2/include/util.h
   trunk/fsck.ocfs2/problem.c
Log:
o just make std{out,err} line buffered to keep them in sync


Modified: trunk/fsck.ocfs2/fsck.c
===================================================================
--- trunk/fsck.ocfs2/fsck.c	2004-11-09 19:42:26 UTC (rev 378)
+++ trunk/fsck.ocfs2/fsck.c	2004-11-09 19:50:02 UTC (rev 379)
@@ -206,24 +206,6 @@
 	printf("\n");
 }
 
-/* we like stdout so people can redirect trivially.  com_err uses stderr.  it
- * is irritating to have reordering in the buffering between stdout and stderr.
- * stdio forgot fdreopen(). */
-static void com_err_stdout(const char *who, long code, const char *fmt, 
-			   va_list ap)
-{
-
-	const struct error_table *et = &et_ocfs_error_table;
-	long offset = code - et->base;
-
-	if (code < et->base || offset >= et->n_msgs)
-		return;
-
-	fprintf(stdout, "%s: %s ", who, et->msgs[offset]);
-	vfprintf(stdout, fmt, ap);
-	fprintf(stdout, "\n");
-}
-
 int main(int argc, char **argv)
 {
 	char *filename;
@@ -242,7 +224,8 @@
 	blkno = 0;
 
 	initialize_ocfs_error_table();
-	set_com_err_hook(com_err_stdout);
+	setlinebuf(stderr);
+	setlinebuf(stdout);
 
 	while((c = getopt(argc, argv, "b:B:npvy")) != EOF) {
 		switch (c) {

Modified: trunk/fsck.ocfs2/include/util.h
===================================================================
--- trunk/fsck.ocfs2/include/util.h	2004-11-09 19:42:26 UTC (rev 378)
+++ trunk/fsck.ocfs2/include/util.h	2004-11-09 19:50:02 UTC (rev 379)
@@ -38,8 +38,6 @@
 
 /* no va_list variant of com_err */
 #define fatal_error(errcode, fmt...) do {				\
-	fflush(stdout);							\
-	fflush(stderr);							\
 	com_err("o2fsck", errcode, fmt);				\
 	exit(FSCK_ERROR);						\
 } while (0)

Modified: trunk/fsck.ocfs2/problem.c
===================================================================
--- trunk/fsck.ocfs2/problem.c	2004-11-09 19:42:26 UTC (rev 378)
+++ trunk/fsck.ocfs2/problem.c	2004-11-09 19:50:02 UTC (rev 379)
@@ -138,8 +138,6 @@
 		else
 			target -= (i % width);
 	}
-
-	fflush(stdout);
 }
 
 /* 



More information about the Ocfs2-tools-commits mailing list