Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

Behavior of open is not consistent when flag O_CREAT is supplied and mode is not supplied

Open bingbing8 opened this issue 8 years ago • 0 comments
trafficstars

Code is at fd32.c: int w32_open(const char pathname, int flags, ... / arg /) { int min_index = fd_table_get_min_index(); struct w32_io pio; va_list valist; u_short mode = 0;

errno = 0;
if (min_index == -1)
	return -1;
if (flags & O_CREAT) {
	va_start(valist, flags);
	mode = va_arg(valist, u_short);
	va_end(valist);
}

...

following test in file_tests.c failed and commented out: { //f = open(tmp_filename, O_WRONLY | O_CREAT | O_TRUNC); //ASSERT_INT_EQ(f, -1); }

bingbing8 avatar Jul 17 '17 21:07 bingbing8