This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

UNLINK problem (again!!)


Hi

I kow that several persons have sent a mail concerning this problem, but 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 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 ----------------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <errno.h>


main()
{
       FILE *fp=NULL;
       int ret;

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

}

------------------------------------------------------------------------------------------------
~

--
Martine Carannante
System Software Development R&D


Bull, Architect of an Open World TM

Tél : (+33) 1 30 80 71 87
http://www.bull.com



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]