-static int handle=0;
-
-int test_yaffs_close_EBADF(void){
- int output=0;
- int error_code=0;
- handle=test_yaffs_open();
- if (handle>=0){
- output=yaffs_close(handle);
- if (output>=0){
- output=yaffs_close(handle);
- if (output<0){
- /*error has happened */
- error_code=yaffs_get_error();
- printf("EEXIST def %d, Error code %d\n",(- EBADF),error_code);
- if (abs(error_code)== EBADF){
+static int handle = -1;
+
+int test_yaffs_close_EBADF(void)
+{
+ int output = 0;
+ int error_code = 0;
+
+ handle = test_yaffs_open();
+ if (handle >= 0){
+ output = yaffs_close(handle);
+ if (output >= 0){
+ output = yaffs_close(handle);
+ if (output < 0){
+ error_code = yaffs_get_error();
+ if (abs(error_code) == EBADF){
+ handle =-1;