From e4ae66f1e304fe10dc6f2092483db2b5158c197b Mon Sep 17 00:00:00 2001
From: Miles Bader <miles@gnu.org>
Date: Fri, 12 May 1995 00:18:25 +0000
Subject: (ext2_error, ext2_warning, ext2_panic): Rename to add the underline
 prefix   (the previous names are now macros that call the renamed functions).
  Also   rearrange a bit to hold the lock around the use of the global message
 buffer.

---
 ext2fs/ext2fs.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

(limited to 'ext2fs/ext2fs.c')

diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index a0d6a64c..2e1dd9e0 100644
--- a/ext2fs/ext2fs.c
+++ b/ext2fs/ext2fs.c
@@ -80,44 +80,50 @@ int printf (const char *fmt, ...)
 
 static char error_buf[1024];
 
-void ext2_error (const char * function, const char * fmt, ...)
+void _ext2_error (const char * function, const char * fmt, ...)
 {
   va_list args;
 
+  mutex_lock(&printf_lock);
+
   va_start (args, fmt);
   vsprintf (error_buf, fmt, args);
   va_end (args);
 
-  mutex_lock(&printf_lock);
   fprintf (stderr, "ext2fs: %s: %s: %s\n", device_name, function, error_buf);
+
   mutex_unlock(&printf_lock);
 }
 
-void ext2_panic (const char * function, const char * fmt, ...)
+void _ext2_panic (const char * function, const char * fmt, ...)
 {
   va_list args;
 
+  mutex_lock(&printf_lock);
+
   va_start (args, fmt);
   vsprintf (error_buf, fmt, args);
   va_end (args);
 
-  mutex_lock(&printf_lock);
   fprintf(stderr, "ext2fs: %s: panic: %s: %s\n", device_name, function, error_buf);
+
   mutex_unlock(&printf_lock);
 
-  exit (0);
+  exit (1);
 }
 
-void ext2_warning (const char * function, const char * fmt, ...)
+void _ext2_warning (const char * function, const char * fmt, ...)
 {
   va_list args;
 
+  mutex_lock(&printf_lock);
+
   va_start (args, fmt);
   vsprintf (error_buf, fmt, args);
   va_end (args);
 
-  mutex_lock(&printf_lock);
   fprintf (stderr, "ext2fs: %s: %s: %s\n", device_name, function, error_buf);
+
   mutex_unlock(&printf_lock);
 }
 
@@ -277,10 +283,9 @@ main (int argc, char **argv)
     error (3, err, "get_hypermetadata");
 
   if (device_size < sblock->s_blocks_count * block_size)
-    ext2_panic("main",
-	       "Disk size (%d) too small (superblock says we need %ld)",
-	       sizes[DEV_GET_SIZE_DEVICE_SIZE],
-	       sblock->s_blocks_count * block_size);
+    ext2_panic ("disk size (%d) too small (superblock says we need %ld)",
+		sizes[DEV_GET_SIZE_DEVICE_SIZE],
+		sblock->s_blocks_count * block_size);
 
   /* A handy source of page-aligned zeros.  */
   vm_allocate (mach_task_self (), &zeroblock, block_size, 1);
-- 
cgit v1.2.3