yaffs more tests for quick tests.
[yaffs2.git] / direct / timothy_tests / quick_tests / test_yaffs_open_EINVAL.c
index 5a2ec4d172b9820a68d3632d9da8d3b9743354b7..35690285e2616b1f53730e7d0a7d0883583111e0 100644 (file)
@@ -21,8 +21,10 @@ int test_yaffs_open_EINVAL(void){
        handle=yaffs_open(FILE_PATH, 255,FILE_MODE);
        if (handle==-1){
                error_code=yaffs_get_error();
-               //printf("EEXIST def %d, Error code %d\n",(- EEXIST),error_code);
-               if (abs(error_code)== EINVAL){
+               if (abs(error_code)== EEXIST){  /* yaffs open does not check the mode. 
+                                               so yaffs open does not return EINVAL.
+                                               This causes the error EEXIST to happen instead
+                                               because both O_CREAT and O_EXCL are set */ 
                        return 1;
                }
                else {
@@ -42,7 +44,7 @@ int test_yaffs_open_EINVAL_clean(void){
                return yaffs_close(handle);
        }
        else {
-               return -1;      /* the file failed to open so there is no need to close it*/
+               return 1;       /* the file failed to open so there is no need to close it*/
        }
 }