Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/TooTallNate/nx.js into socket
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Nov 6, 2023
2 parents 79cb4bd + c40faa9 commit 53c8f96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-hairs-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nxjs-runtime': patch
---

Fix false-positive errors in FS sync functions
3 changes: 3 additions & 0 deletions source/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct

JSValue nx_readdir_sync(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
errno = 0;
DIR *dir;
struct dirent *entry;

Expand Down Expand Up @@ -155,6 +156,7 @@ JSValue nx_read_file(JSContext *ctx, JSValueConst this_val, int argc, JSValueCon

JSValue nx_read_file_sync(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
errno = 0;
const char *filename = JS_ToCString(ctx, argv[0]);
FILE *file = fopen(filename, "rb");
if (file == NULL)
Expand Down Expand Up @@ -192,6 +194,7 @@ JSValue nx_read_file_sync(JSContext *ctx, JSValueConst this_val, int argc, JSVal

JSValue nx_write_file_sync(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
errno = 0;
const char *filename = JS_ToCString(ctx, argv[0]);
FILE *file = fopen(filename, "w");
if (file == NULL)
Expand Down

0 comments on commit 53c8f96

Please sign in to comment.