rename() cannot replace the file which is opened with writable access
Thu Jan 12 00:07:00 GMT 2017
I've found that rename() cannot replace the file
which is opened with writable access on Cygwin.
On Linux, it works.
If I understand correctly, it should work under POSIX.
Here's sample code for reproduce.
#define OLDPATH "oldpath"
#define NEWPATH "newpath"
int main ()
struct flock fl;
char buff = "test";
/* create oldpath file */
fd = open (OLDPATH, O_CREAT | O_RDWR | O_TRUNC, 0666);
/* create newpath file */
fd = open (NEWPATH, O_CREAT | O_RDWR | O_TRUNC, 0666);
/* rename *** FAILED on Cygwin *** */
if (rename (OLDPATH, NEWPATH) < 0)
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin