Parrot_io_open_unix() Question

chromatic chromatic at wgz.org
Fri Feb 20 02:52:17 UTC 2009


I don't understand this function.  I expect that:

	$P0.'open'( 'bad_file' )

... should throw an exception as it tries to read a file that doesn't exist, 
but this code appears to try to open a file descriptor for writing, reading 
and writing, and appending as the first step toward seeing if the open() 
system call can succeed:
	/* Try open with no create first */
	while ((fd = open(spath, oflags & (O_WRONLY | O_RDWR | O_APPEND),
				 DEFAULT_OPEN_MODE))
		< 0 && errno == EINTR)
		errno = 0;

The default file mode without a specified mode is read-only mode.  Why does 
this code give me back a working FileHandle when it can't read the file?

-- c




More information about the parrot-dev mailing list