problem of read or write OPs after unlink() while the file is opening

From: Íõ ÁÁ (wangl_at_ncic.ac.cn)
Date: Sun May 08 2005 - 19:01:53 PDT

  • Next message: Paul H. Hargrove: "Re: problem of read or write OPs after unlink() while the file is opening"
    Hi!
    	 CR_Restart operation will not succeed if a file is unlinked while opening.
    	 Because it can not reopen the file when restart. 
    	 I don't know it is a bug or not.  
    	 The test code is  as follows :	
     /* -------------------------------------------------------------------------------------------------------------------- */
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    
    int main(void)
    {
    	int fd;
    	int i;
    	
    	fd = open("data", O_RDWR | O_TRUNC | O_CREAT, 00600);
    	
    	if (unlink("data") < 0) {
    		printf("unlink error\n");
    	}
    	printf("checkpointing here ... \n");
    	getchar();
         
    	/*
    		read() or write() on this file description ...
    	*/
    
    	printf("failing here ... \n");
    	getchar();		
    	
    	return 0;
    }
      /* -------------------------------------------------------------------------------------------------------------------- */
    
     Thanks!
    
    
    [email protected]
    2005-05-09
    

  • Next message: Paul H. Hargrove: "Re: problem of read or write OPs after unlink() while the file is opening"