Skip to content

Commit

Permalink
Merge pull request #1052 from Andy-Python-Programmer/p1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisbonke authored Apr 7, 2024
2 parents 5f3b95b + 0d29bcd commit 71d6b32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
27 changes: 14 additions & 13 deletions sysdeps/aero/generic/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,24 @@ int sys_close(int fd) {
return 0;
}

int sys_access(const char *filename, int mode) {
auto result =
syscall(SYS_ACCESS, AT_FDCWD, filename, strlen(filename), mode, 0);

if (result < 0) {
return -result;
}

int sys_faccessat(int dirfd, const char *pathname, int mode, int flags) {
auto ret = syscall(SYS_ACCESS, dirfd, pathname, strlen(pathname), mode, flags);
if(int e = sc_error(ret); e)
return e;
return 0;
}

int sys_access(const char *filename, int mode) {
return sys_faccessat(AT_FDCWD, filename, mode, 0);
}

int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags,
struct stat *statbuf) {
switch (fsfdt) {
case fsfd_target::path:
fd = AT_FDCWD;
break;

case fsfd_target::fd:
flags |= AT_EMPTY_PATH;

Expand Down Expand Up @@ -199,14 +200,14 @@ int sys_rmdir(const char *path) {
}

int sys_unlinkat(int fd, const char *path, int flags) {
auto ret = syscall(SYS_UNLINK, fd, path, strlen(path), flags);
if (int e = sc_error(ret); e)
return e;
return 0;
auto ret = syscall(SYS_UNLINK, fd, path, strlen(path), flags);
if (int e = sc_error(ret); e)
return e;
return 0;
}

int sys_symlink(const char *target_path, const char *link_path) {
return sys_symlinkat(target_path, AT_FDCWD, link_path);
return sys_symlinkat(target_path, AT_FDCWD, link_path);
}

int sys_symlinkat(const char *target_path, int dirfd, const char *link_path) {
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/aero/include/abi-bits/fcntl.h
2 changes: 1 addition & 1 deletion sysdeps/aero/include/abi-bits/stat.h

0 comments on commit 71d6b32

Please sign in to comment.