Skip to content

Commit 4e6d9a7

Browse files
authored
Remove abort from __syscall_unlinkat (#24258)
Instead just return EINVAL.
1 parent aeefd94 commit 4e6d9a7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lib/libsyscall.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ var SyscallsLibrary = {
864864
var nofollow = flags & {{{ cDefs.AT_SYMLINK_NOFOLLOW }}};
865865
flags = flags & (~{{{ cDefs.AT_SYMLINK_NOFOLLOW }}});
866866
#if ASSERTIONS
867-
assert(flags === 0);
867+
assert(!flags);
868868
#endif
869869
path = SYSCALLS.calculateAt(dirfd, path);
870870
(nofollow ? FS.lchown : FS.chown)(path, owner, group);
@@ -884,12 +884,12 @@ var SyscallsLibrary = {
884884
__syscall_unlinkat: (dirfd, path, flags) => {
885885
path = SYSCALLS.getStr(path);
886886
path = SYSCALLS.calculateAt(dirfd, path);
887-
if (flags === 0) {
887+
if (!flags) {
888888
FS.unlink(path);
889889
} else if (flags === {{{ cDefs.AT_REMOVEDIR }}}) {
890890
FS.rmdir(path);
891891
} else {
892-
abort('Invalid flags passed to unlinkat');
892+
return -{{{ cDefs.EINVAL }}};
893893
}
894894
return 0;
895895
},
@@ -933,7 +933,7 @@ var SyscallsLibrary = {
933933
__syscall_faccessat: (dirfd, path, amode, flags) => {
934934
path = SYSCALLS.getStr(path);
935935
#if ASSERTIONS
936-
assert(flags === 0 || flags == {{{ cDefs.AT_EACCESS }}});
936+
assert(!flags || flags == {{{ cDefs.AT_EACCESS }}});
937937
#endif
938938
path = SYSCALLS.calculateAt(dirfd, path);
939939
if (amode & ~{{{ cDefs.S_IRWXO }}}) {
@@ -958,7 +958,7 @@ var SyscallsLibrary = {
958958
__syscall_utimensat: (dirfd, path, times, flags) => {
959959
path = SYSCALLS.getStr(path);
960960
#if ASSERTIONS
961-
assert(flags === 0);
961+
assert(!flags);
962962
#endif
963963
path = SYSCALLS.calculateAt(dirfd, path, true);
964964
var now = Date.now(), atime, mtime;

0 commit comments

Comments
 (0)