* open-output-file now uses a bytevector instead of a string to

represent the filename during ffi.
This commit is contained in:
Abdulaziz Ghuloum 2007-05-18 21:06:25 -04:00
parent 1586986dbe
commit 179063c117
4 changed files with 9 additions and 3 deletions

Binary file not shown.

View File

@ -842,8 +842,14 @@ ikrt_open_output_file(ikp fname, ikp flagptr, ikpcb* pcb){
(int)flagptr);
exit(-10);
}
int fd = open(string_data(fname), flags,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
char* name;
if(tagof(fname) == bytevector_tag){
name = (char*) fname + off_bytevector_data;
} else {
fprintf(stderr, "bug in ikrt_open_output_file\n");
exit(-1);
}
int fd = open(name, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if(fd == -1){
fprintf(stderr, "openfile failed: %s\n", strerror(errno));
return false_object;

Binary file not shown.

View File

@ -132,7 +132,7 @@
(close-ports)
(let ([fd/error
(foreign-call "ikrt_open_output_file"
filename
(string->utf8-bytevector filename)
(option-id options))])
(if (fixnum? fd/error)
(let ([port