- 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 (handle == -1){
+ error_code = yaffs_get_error();
+ if (abs(error_code) == EEXIST){ /* yaffs open does not check the mode which is passed into the functon.
+ so yaffs open does not return EINVAL.
+ This causes the error EEXIST to happen instead
+ because both O_CREAT and O_EXCL are set */