Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
[yaffs2.git] / direct / timothy_tests / dev / error_handler.c
index 2beca41cc533cd0c414661da07bcf8cd11d26c05..a9152f3a2dc1c7c301fe6e3db7b6934428fb479d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet another FFS. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Timothy Manning <timothy@yaffs.net>
@@ -65,12 +65,13 @@ void yaffs_check_for_errors(char output, buffer *message_buffer,char error_messa
        {
                add_to_buffer(message_buffer, "\nerror##########",MESSAGE_LEVEL_ERROR,PRINT);
                add_to_buffer(message_buffer, error_message,MESSAGE_LEVEL_ERROR,PRINT);
-               add_to_buffer(message_buffer, "error_code: ",MESSAGE_LEVEL_ERROR,PRINT);
+               add_to_buffer(message_buffer, "error_code: ",MESSAGE_LEVEL_ERROR,NPRINT);
                yaffs_error=yaffs_get_error();
-               if (MESSAGE_LEVEL_ERROR<=DEBUG_LEVEL)   printf("%d\n",yaffs_error);     /*cannot yet add int types to buffer. this is a quick fix*/     
+               append_int_to_buffer(message_buffer, yaffs_error,MESSAGE_LEVEL_ERROR,PRINT);
+
                add_to_buffer(message_buffer, error_to_str(yaffs_error),MESSAGE_LEVEL_ERROR,NPRINT);
                append_to_buffer(message_buffer, "\n\n",MESSAGE_LEVEL_ERROR,PRINT);     
-               exit(1);                
+               quit_program();
                //scanf("%c",dummy);    /*this line causes a segmentation fault. Need a better way of waiting for a key press*/
                //print_buffer(message_buffer,PRINT_ALL);