delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/10/11:58:28

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3BC46ECE.AEE3046@syntrex.com>
Date: Wed, 10 Oct 2001 17:52:46 +0200
From: Pavel Tsekov <ptsekov AT syntrex DOT com>
Organization: Syntrex Inc.
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: luke_bakken AT yahoo DOT com
CC: cygwin AT cygwin DOT com
Subject: Re: 1.3.3 - fcntl locking + rename bug
References: <Pine DOT BSO DOT 4 DOT 31 DOT 0110091320450 DOT 15251-300000 AT ics-server DOT interface-net DOT com>

Hey, Luke

You can't do that on windows :) It doesn't allow
to remove a file while you hold an open handle
to it.

Btw look at this sample of using MoveFile API, which
is used to implement the rename call:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/filesio_9bhh.asp

Hope this helps.

Luke Bakken wrote:
> 
> Hi all,
> 
> I've been fighting LPRng for about a month now trying to get it working on
> cygwin, and have finally succeeded. Hooray!
> 
> However, I think I have discovered a bug in the following situation, which
> occurs frequently in LPRng:
> 
> Open a status file (named lpq in LPRng's case) for WR, and get a lock on
> it with fcntl (call it lockfd).
> 
> Create a tempfile (tempfd), stuff it with info, and close tempfd.
> 
> Rename tempfile to status file - this causes error "Permission Denied".
> 
> Close lockfd.
> 
> To get LPRng to work sucessfully, I had to move the "close lockfd"
> *before* attempting to rename the tempfile.  I have written a small test
> program (composed mainly of code straight from LPRng) to verify the above
> behavior (locktest.c) and it does reproduce the problem as it occurs in
> LPRng on cygwin.  The test program (as well as LPRng) both work fine on my
> OpenBSD machine.
> 
> Attached is the output of cygcheck -s -v -r as well as the test program.
> 
> Thanks!  If people are interested in LPRng for Cygwin, please let me know
> - I'm now going to get the setuid stuff working.
> 
> Luke Bakken

--
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/

- Raw text -


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