rktio: repairs to file & directory operations

This commit is contained in:
Matthew Flatt 2017-06-13 20:06:49 -06:00
parent 6268cd7ce9
commit 0402075f2b
2 changed files with 10 additions and 7 deletions

View File

@ -2041,6 +2041,8 @@ Scheme_Object *scheme_get_fd_identity(Scheme_Object *port, intptr_t fd, char *pa
args[1] = scheme_make_integer(ident->c_bits + ident->b_bits);
a = scheme_bitwise_shift(2, args);
free(ident);
return scheme_bin_plus(scheme_bin_plus(a, b), c);
}
@ -3423,7 +3425,7 @@ static Scheme_Object *delete_file(int argc, Scheme_Object **argv)
filename_for_error(argv[0]));
}
return NULL;
return scheme_void;
}
static Scheme_Object *rename_file(int argc, Scheme_Object **argv)
@ -3661,7 +3663,7 @@ static Scheme_Object *do_resolve_path(int argc, Scheme_Object *argv[], int guard
if (content) {
Scheme_Object *r;
r = scheme_make_sized_path(content, len, 1);
r = scheme_make_sized_path(content, -1, 1);
free(content);
return r;
}
@ -4913,6 +4915,7 @@ static Scheme_Object *file_or_dir_permissions(int argc, Scheme_Object *argv[])
l = scheme_make_pair(write_symbol, l);
if (r & RKTIO_PERMISSION_EXEC)
l = scheme_make_pair(execute_symbol, l);
return l;
}
}
} else {
@ -5368,7 +5371,7 @@ find_system_path(int argc, Scheme_Object **argv)
s = rktio_system_path(scheme_rktio, which);
p = scheme_make_sized_offset_path(s, 1, -1, 1);
p = scheme_make_sized_offset_path(s, 0, -1, 1);
if (!scheme_is_complete_path(SCHEME_PATH_VAL(p), SCHEME_PATH_LEN(p), SCHEME_PLATFORM_PATH_KIND)) {
p = scheme_path_to_complete_path(p, original_pwd);

View File

@ -661,7 +661,7 @@ static rktio_identity_t *get_identity(rktio_t *rktio, rktio_fd_t *fd, char *path
uintptr_t devi = 0, inoi = 0, inoi2 = 0;
uintptr_t devi_bits = 0, inoi_bits = 0, inoi2_bits = 0;
#ifdef FILES_HAVE_FDS
#ifdef RKTIO_SYSTEM_UNIX
int errid = 0;
struct MSC_IZE(stat) buf;
@ -689,7 +689,7 @@ static rktio_identity_t *get_identity(rktio_t *rktio, rktio_fd_t *fd, char *path
inoi_bits = sizeof(buf.st_ino) << 3;
}
#endif
#ifdef WINDOWS_FILE_HANDLES
#ifdef RKTIO_SYSTEM_WINDOWS
BY_HANDLE_FILE_INFORMATION info;
HANDLE fdh;
@ -1767,7 +1767,7 @@ static char *append_paths(char *a, char *b, int free_a, int free_b)
int sep_len = 0;
char *s;
if (!IS_A_SEP(a[alen]))
if (alen && !IS_A_SEP(a[alen-1]))
sep_len = 1;
s = malloc(alen + sep_len + blen + 1);
@ -1776,7 +1776,7 @@ static char *append_paths(char *a, char *b, int free_a, int free_b)
if (sep_len)
s[alen] = A_PATH_SEP;
memcpy(s+alen+sep_len, b, blen);
s[alen + blen] = 0;
s[alen + sep_len + blen] = 0;
if (free_a) free(a);
if (free_b) free(b);