This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DELETE_ON_CLOSE on Win98/ME


Chris, 

here is what I observe on Win98/ME. There is never any problem
if the file is not read-only. If it is, the sequence

CreateFile(  FILE_FLAG_DELETE_ON_CLOSE )
SetFileAttributes (read_only)
CloseHandle ()
has the following result:
1) File on local disk:  not deleted
2) File on shared drive, mounted on 98/ME: deleted
3) File on shared drive, mounted on NT class: not deleted 
   So in the case of read-only hard link, I see no way to avoid
   leaving the surviving copy as read-write.

The CloseHandle always returns OK. So, short of checking for
deletion each time, I see two ways of handling the situation
A) 
CreateFile(  FILE_FLAG_DELETE_ON_CLOSE )
if (wincap.has_hard_links ())
  SetFileAttributes ( read_only)
CloseHandle ()

B) (simpler/faster, same overall result)
if (wincap.has_delete_on_close ()) 
  {
    CreateFile(  FILE_FLAG_DELETE_ON_CLOSE )
    SetFileAttributes ( read_only)
    CloseHandle ()
  }

Pierre

 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]