delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/20/11:07:11

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.2 required=5.0 tests=AWL,BAYES_20,RCVD_BAD_ID
X-Spam-Check-By: sourceware.org
Message-ID: <49C3BF14.5000602@bull.net>
Date: Fri, 20 Mar 2009 17:06:44 +0100
From: Martine Carannante <Martine DOT Carannante AT bull DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.6) Gecko/20050319
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: UNLINK problem (again!!)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Hi

I kow that several persons have sent a mail concerning this problem, but=20
unfortunately I don't see a clear solution in the mailing list.
It seems to me very strange because  this kind of code happens very often .

My problem is that we can't recreate a file  immediately after an=20
unlink() of this file.I have   a permission denied.

Here is  my test program testop.c. When I execute it :
$ ./testop
Create file
unlink file
Create Again the file
Error Create: : Permission denied

Thanks in advance for your help
Best regards
Martine

---------------------------------------- testop.c=20
----------------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <errno.h>

main()
{
        FILE *fp=3DNULL;
        int ret;

        printf("Create file\n");
        if((fp=3Dfopen("toto","a+"))=3D=3DNULL) {
                perror("Error Create: ");
                exit(255);
        }
        printf("unlink file\n");
        ret=3Dunlink("toto");
        if (ret !=3D 0) {
                perror("Error Unlink: ");
                exit(255);
        }
        printf("Create Again the file\n");
        if((fp=3Dfopen("toto","a+"))=3D=3DNULL) {
                perror("Error Create: ");
                exit(255);
        }

}

---------------------------------------------------------------------------=
---------------------
~

--=20
Martine Carannante
System Software Development R&D=20

Bull, Architect of an Open World TM=20

T=E9l : (+33) 1 30 80 71 87
http://www.bull.com=20


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