The `sys_symlink()` function returns `ENOENT` if the lookup failed,
instead of the actual error code `lookup()` exited with.
This may not always be right, since `lookup()` can return other error
codes (for example `ELOOP`).
Fix that by not setting the error code and just jump to the end of the
function.
Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
GitHub-Closes: #849
Reviewed-by: Andra Paraschiv <andra@unikraft.io>
Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #851
}
/* parent directory for new path must exist */
- if ((error = lookup(np, &newdirdp, &name)) != 0) {
- error = ENOENT;
+ if ((error = lookup(np, &newdirdp, &name)) != 0)
goto out;
- }
+
vn_lock(newdirdp->d_vnode);
/* newpath should not already exist */