diff options
author | sotech117 <michael_foiani@brown.edu> | 2024-05-14 03:19:46 +0000 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2024-05-14 03:19:46 +0000 |
commit | 06d50155ac0bd079bfca0f5728346d8beeb205f2 (patch) | |
tree | 2f20c8ba099304d6ea06fb76e8a0807b8afa5a5f /kernel/fs/vfs_syscall.c | |
parent | 7585cb5ad84babe9db8c6595de464e33fb878f0c (diff) |
weenix fixes
Diffstat (limited to 'kernel/fs/vfs_syscall.c')
-rw-r--r-- | kernel/fs/vfs_syscall.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/fs/vfs_syscall.c b/kernel/fs/vfs_syscall.c index 245e55d..fc0878e 100644 --- a/kernel/fs/vfs_syscall.c +++ b/kernel/fs/vfs_syscall.c @@ -569,6 +569,10 @@ long do_link(const char *oldpath, const char *newpath) // NOT_YET_IMPLEMENTED("VFS: do_link"); // Resolve the oldpath + if (strlen(newpath) > NAME_LEN) + { + return -ENAMETOOLONG; + } vnode_t *old_vnode = NULL; long ret = namev_resolve(NULL, oldpath, &old_vnode); @@ -599,6 +603,7 @@ long do_link(const char *oldpath, const char *newpath) if (!S_ISDIR(dir->vn_mode)) { vput(&old_vnode); + vput(&dir); return -ENOTDIR; } // Check if name is too long @@ -610,7 +615,7 @@ long do_link(const char *oldpath, const char *newpath) // Lock the vnodes and call link vlock_in_order(old_vnode, dir); - ret = dir->vn_ops->link(old_vnode, dir, name, len); + ret = dir->vn_ops->link(dir, name, len, old_vnode); vunlock_in_order(old_vnode, dir); vput(&old_vnode); |