yaffs direct tests: Modify some tests to check properly
[yaffs2.git] / direct / timothy_tests / quick_tests / test_yaffs_fstat.c
index 73451611c162ce4bc80650bc6d852f8cfa47b575..dfdc80d65ae3a43f288185b0e144b3e1c654be6a 100644 (file)
 
 #include "test_yaffs_fstat.h"
 
-static int handle=0;
-int test_yaffs_fstat(void){
+static int handle = -1;
+int test_yaffs_fstat(void)
+{
        struct yaffs_stat stat;
-       handle=test_yaffs_open();
-       if (handle>=0){
-               return  yaffs_fstat(handle , &stat);;
-       }
-       else {
-               printf("error opening file\n");
+       handle = test_yaffs_open();
+
+       if (handle >= 0){
+               return  yaffs_fstat(handle , &stat);
+       else {
+               print_message( "error opening file\n", 2 );
                return -1;
        }
 }
 
-int test_yaffs_fstat_clean(void){
-       if (handle<0){
+int test_yaffs_fstat_clean(void)
+{
+       if (handle <= 0){
                return yaffs_close(handle);
        }
        return 1;