Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Message-Id: <3.0.5.32.20030317201728.007f3d10@incoming.verizon.net> X-Sender: vze1u1tg AT incoming DOT verizon DOT net Date: Mon, 17 Mar 2003 20:17:28 -0500 To: From: "Pierre A. Humblet" Subject: DELETE_ON_CLOSE on Win98/ME In-Reply-To: References: <20030317145931 DOT GA30463 AT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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