[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another patch...



Hre is another patch for MiNT 1.09...
My problem was: I wrote a tape device driver which needs to access a
SCSI device driver and therefore calls f_open in its own open-function.

Unfortunately the code of f_open (and f_create) is not reeantrant.

*** dosfile.c.orig	Fri Feb 11 14:18:54 1994
--- dosfile.c	Fri Feb 11 14:38:27 1994
***************
*** 348,356 ****
  		mode = (mode & ~O_RWMODE) | O_RDWR;
  	}
  
  	f = do_open(name, mode, 0, (XATTR *)0);
  
- 
  	if (!f) {
  		return mint_errno;
  	}
--- 348,357 ----
  		mode = (mode & ~O_RWMODE) | O_RDWR;
  	}
  
+ 	proc->handle[i]= (FILEPTR *)1; /* Reserve this handle */
  	f = do_open(name, mode, 0, (XATTR *)0);
+ 	proc->handle[i]= (FILEPTR *)0; /* and release it again */
  
  	if (!f) {
  		return mint_errno;
  	}
***************
*** 422,428 ****
--- 423,431 ----
  		return EACCDN;
  	}
  
+ 	proc->handle[i]= (FILEPTR *)1; /* Reserve this handle */
  	f = do_open(name, O_RDWR|O_CREAT|O_TRUNC, attrib, (XATTR *)0);
+ 	proc->handle[i]= (FILEPTR *)0; /* and release it again */
  
  	if (!f) {
  		DEBUG(("Fcreate(%s) failed, error %d", name, mint_errno));