Have rename() semantics changed?

Stewart Greenhill greenhil@murdoch.edu.au
Wed Jul 12 20:56:00 GMT 2000


Hi,

The latest cygwin seems not to allow open files to be renamed. This
works under Unix. It is not normally allowed under Windows, but worked
in previous versions of the cygwin environment.

Is this an official change, or could it be a bug?

I noticed this because it broke the OOC Oberon-2 compiler
(ooc.sourgeforge.net) under cygwin. The following code snippet
demonstrates the problem.

#include <stdio.h>

char * oldName = "test.file^";
char * newName = "test.file";

int main(int argc, char ** argv) {
	int result;
	FILE * f = fopen(oldName, "w");

	result = rename(oldName, newName);
	if (result != 0) {
		perror("Rename");
	} else {
		printf("OK!");
	}
	fclose(f);
}

The latest cygwin (1.1.2) now returns an error 13 (permission denied).

Cheers,
  - Stewart

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list