Skip to content

Commit

Permalink
rename EACCES to EACCESS
Browse files Browse the repository at this point in the history
The WASI spec has decided to deviate from POSIX starting in
snapshot preview 2.

Refs: #59
  • Loading branch information
cjihrig committed Apr 20, 2020
1 parent 257e85d commit 2315bf6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ Possible values:

Argument list too long.

- <a href="#errno.acces" name="errno.acces"></a>**`UVWASI_EACCES`**
- <a href="#errno.access" name="errno.access"></a>**`UVWASI_EACCESS`**

Permission denied.

Expand Down
2 changes: 1 addition & 1 deletion include/wasi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef uint64_t uvwasi_dircookie_t;
typedef uint16_t uvwasi_errno_t;
#define UVWASI_ESUCCESS 0
#define UVWASI_E2BIG 1
#define UVWASI_EACCES 2
#define UVWASI_EACCESS 2
#define UVWASI_EADDRINUSE 3
#define UVWASI_EADDRNOTAVAIL 4
#define UVWASI_EAFNOSUPPORT 5
Expand Down
2 changes: 1 addition & 1 deletion src/uv_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
uvwasi_errno_t uvwasi__translate_uv_error(int err) {
switch (err) {
case UV_E2BIG: return UVWASI_E2BIG;
case UV_EACCES: return UVWASI_EACCES;
case UV_EACCES: return UVWASI_EACCESS;
case UV_EADDRINUSE: return UVWASI_EADDRINUSE;
case UV_EADDRNOTAVAIL: return UVWASI_EADDRNOTAVAIL;
case UV_EAFNOSUPPORT: return UVWASI_EAFNOSUPPORT;
Expand Down
2 changes: 1 addition & 1 deletion src/uvwasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ const char* uvwasi_embedder_err_code_to_string(uvwasi_errno_t code) {
switch (code) {
#define V(errcode) case errcode: return #errcode;
V(UVWASI_E2BIG)
V(UVWASI_EACCES)
V(UVWASI_EACCESS)
V(UVWASI_EADDRINUSE)
V(UVWASI_EADDRNOTAVAIL)
V(UVWASI_EAFNOSUPPORT)
Expand Down
5 changes: 4 additions & 1 deletion test/test-uv-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
int main(void) {
/* Verify error code translation. */
CHECK_ERR(E2BIG);
CHECK_ERR(EACCES);
CHECK_ERR(EADDRINUSE);
CHECK_ERR(EADDRNOTAVAIL);
CHECK_ERR(EAFNOSUPPORT);
Expand Down Expand Up @@ -63,6 +62,10 @@ int main(void) {
CHECK_ERR(ETIMEDOUT);
CHECK_ERR(ETXTBSY);
CHECK_ERR(EXDEV);

/* EACCES is no longer consistently named. */
assert(uvwasi__translate_uv_error(UV_EACCES) == UVWASI_EACCESS);

assert(uvwasi__translate_uv_error(0) == UVWASI_ESUCCESS);
assert(uvwasi__translate_uv_error(1) == 1);
assert(uvwasi__translate_uv_error(-99999) == UVWASI_ENOSYS);
Expand Down

0 comments on commit 2315bf6

Please sign in to comment.