Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 2e570f7

Browse files
authored
Merge pull request #64 from kazumi007/fix-statfs
Use panic() instead of assert() in darwin_statfs
2 parents 788ba08 + a83dc3d commit 2e570f7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/fs/fs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,11 @@ darwinfs_statfs(struct fs *fs, struct dir *dir, const char *path, struct l_statf
983983
if (dir->fd != AT_FDCWD) {
984984
path_to_statfs = full_path;
985985
char at_path[PATH_MAX];
986-
assert(fcntl(dir->fd, F_GETPATH, at_path) == 0); // fd must be a regular directory to which fcntl should succeed
986+
// fd must be a regular directory to which fcntl should succeed
987+
int r = fcntl(dir->fd, F_GETPATH, at_path);
988+
if (r != 0) {
989+
panic("fcntl failed");
990+
}
987991
if (snprintf(full_path, PATH_MAX, "%s/%s", at_path, path) >= PATH_MAX) {
988992
return -LINUX_ENAMETOOLONG;
989993
}
@@ -1504,7 +1508,6 @@ DEFINE_SYSCALL(linkat, int, oldfd, gstr_t, oldpath_ptr, int, newfd, gstr_t, newp
15041508
}
15051509

15061510
int lkflag = flags & LINUX_AT_SYMLINK_FOLLOW ? 0 : LOOKUP_NOFOLLOW;
1507-
15081511
struct path oldpath, newpath;
15091512
int r;
15101513
if ((r = vfs_grab_dir(oldfd, oldname, lkflag, &oldpath)) < 0) {

0 commit comments

Comments
 (0)