bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] GNUBg Win32 Index


From: Joern Thyssen
Subject: Re: [Bug-gnubg] GNUBg Win32 Index
Date: Fri, 24 Jan 2003 13:21:33 +0000
User-agent: Mutt/1.4i

On Fri, Jan 24, 2003 at 10:29:59AM +0000, address@hidden wrote
> Hi,
> 
> I seem to have a problem with gnu backgammon on Windows (2000) and know of 
> another person with the same problem.
> 
> When I go to Analysis then Player Record and try to delete a players
> records I get the following error:
> 
> ./.gnubgpr: Permission Denied
> 
> I have e-mailed Nardy Pillards who suggested I deleted the file above. I 
> did but I still get the same message once I create a new record.
> 
> I am using 030122 but it has been doing it ever since I started using this
> excellent program (about 3 weeks or so).

There are no problems under unix systems. However, for some odd
reason windows thinks it's not possible to overwrite existing files with
"rename". For that reason I've added some code that deletes the
destination file if existing:

record.c:

    sprintf( sz, "%s/.gnubgpr", szHomeDirectory );

#ifdef WIN32
    /* experiment */
    if ( unlink ( sz ) && errno != ENOENT ) {
      /* do not complain if file is not found */
      outputerr ( sz );
      free ( pchOut );
      return -1;
    }
#endif

    if( rename( pchOut, sz ) ) {
        outputerr( sz );
        free( pchOut );
        return -1;
    }

    free( pchOut );
    return 0;
}

The question is why this code doesn't work!! 

Nardy or Øystein, assuming you can reproduce this problem on your system
as well, can you insert a few debug outputs:

    sprintf( sz, "%s/.gnubgpr", szHomeDirectory );

#ifdef WIN32
    outputf ( "Unlink file '%s'\n", sz );
    /* experiment */
    if ( unlink ( sz ) && errno != ENOENT ) {
       int  = errno;
      /* do not complain if file is not found */
      outputerr ( sz );
      outputf ( "error encountered: %d\n", i );
      free ( pchOut );
      return -1;
    }
#endif

    outputf ( "rename '%s' to '%s'\n", pchOut, sz );
    if( rename( pchOut, sz ) ) {
       int i = errno;
        outputerr( sz );
        outputf ( "Error encountered: %d\n", i );
        free( pchOut );
        return -1;
    }

    free( pchOut );
    return 0;
}

Jørn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]