Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <200304111707.h3BH71kx006392@phys-nfs1.tvi.cc.nm.us> Date: Fri, 11 Apr 2003 11:06:49 -0600 (MDT) From: dmay AT tvi DOT edu Reply-To: dmay AT tvi DOT edu Subject: RE: Problem with database engine on Cygwin To: cygwin AT cygwin DOT com cc: dmay AT tvi DOT edu MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii > From: cygwin-owner at cygwin dot com [mailto:cygwin-owner at cygwin dot com]On Behalf > Of dmay at tvi dot edu > I worked around the issue in my code by closing the offending > file, renaming > it to a 20 character pseudo-random string and then deleting it. > When I did > that, I had no problem creating another file with the same name. > The problem > here is if I happen to get 2 20-character psuedo-random strings that are > identical (not likely, I know), this is going to fail. > > So, I kludged it in a somewhat unclean, albeit functional, way. Is there > another workaround that is a little more elegant? Might it be that this helps? $ man 3 mktemp /Hannu E K Nevalainen, Mariefred, Sweden -- I apologize that I didn't get a chance to respond to this right away. I inadvertently deleted it from my email before I could respond :o< Anyway, I don't think you understand the issue here...Basically, mktemp creates a temporary file that is unique for what exists in the directory now. However, it does not and cannot guarantee to never create a temporary file that has the same name as one that has been deleted by the current process. That is the functionality I would really need to fix this problem, and mktemp doesn't do that, unless it works very differently on Cygwin than it does elsewhere. Please see one of my previous posts with a small C program that demonstrates this issue. At any rate, I got an idea from this list to use a time stamp as part of the file name, that way it would be guaranteed unique unless the time were changed. That combined with the 20 character psuedo-random string gives me a name that is sufficiently irreproduceable that I am comfortable it won't happen under the same process (not in this universe, anyway :o). Thanks for the input and ideas. -- ================================= David May Senior UNIX System Administrator Albuquerque TVI 505-224-3015 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/