diff --git a/modules/io/files/littlefs/files-littlefs.c b/modules/io/files/littlefs/files-littlefs.c index 45e615ba24..16636edae6 100644 --- a/modules/io/files/littlefs/files-littlefs.c +++ b/modules/io/files/littlefs/files-littlefs.c @@ -586,7 +586,6 @@ void xs_stat_isDirectory(xsMachine *the) void xs_stat_isSymbolicLink(xsMachine *the) { - xsmcGet(xsResult, xsThis, xsID_mode); xsmcSetFalse(xsResult); } diff --git a/modules/io/files/posix/files-posix.c b/modules/io/files/posix/files-posix.c index 0dc6caa020..51a621f2e8 100644 --- a/modules/io/files/posix/files-posix.c +++ b/modules/io/files/posix/files-posix.c @@ -161,8 +161,7 @@ void xs_fileposix_read(xsMachine *the) returnLength = 1; } - throwIf(lseek(fd, position, SEEK_SET)); - int result = read(fd, buffer, length); + int result = pread(fd, buffer, length, position); throwIf(result); if (returnLength) @@ -179,8 +178,7 @@ void xs_fileposix_write(xsMachine *the) xsUnsignedValue length; xsmcGetBufferWritable(xsArg(0), &buffer, &length); - throwIf(lseek(fd, position, SEEK_SET)); - throwIf(write(fd, buffer, length)); + throwIf(pwrite(fd, buffer, length, position)); } void xs_fileposix_status(xsMachine *the)