delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/15/05:53:21

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: Unable to delete directory in Cygwin
Date: Thu, 15 Jun 2006 15:23:04 +0530
Message-ID: <1F211FE03383644EAA6BB7A52FCD9B9B0927A4@sohm.kpit.com>
In-Reply-To: <1F211FE03383644EAA6BB7A52FCD9B9B0927A0@sohm.kpit.com>
From: "Gina Verlekar" <GinaV AT KPITCummins DOT com>
To: <cygwin AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k5F9rHvg019720

Hi,

I have implemented some changes in the linker code for some intermediate

processing. 
For that I need to create a temporary directory, generate some
intermediate 
files in it, process those files by calling a function. After processing
of the	
intermediate files, I delete the intermediate files and the temporary
directory.	
While this logic works fine in the linux, the temporary directory does
not get	
deleted in cygwin.

/* ldmain.c */
main()
{
.
.
my_function();
.
.
delete tmp_directory;//I have to delete the tmp_directory only here 
}


/* myfile.c */
my_function()
{
create tmp directory tmp_directory;
.
create intermediate files in the above directory; .
my_process_function(intermediate files);//processes the intermediate
files .
return;
}



my_process_function(files)
{
.
process the intermediate files;
.
delete the intermediate files;// I cannot delete the tmp_directory here
return; 
}



After debugging using gdb, I found that in cygwin, the intermediate
files still 
had some handlers open for it inspite of reaching till the end of the
main() 
function in linker. Due to this, the temporary files get deleted only
after 
exiting from the main. Hence as the temporary drectory is not empty till
then,
it cannot get deleted.

This behaviour is not seen in linux. Care has been taken in the code for
correct
opening and closing of the intermediate files.

Is this a known behavior in cygwin? Any inputs will be appreciated. 

Regards,
Gina Verlekar
KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
and M32C Series.
The following site also offers free technical support to its users. 
Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on June 1, 2006.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019