Module Name: src Committed By: christos Date: Sat Jun 29 13:31:07 UTC 2024
Modified Files: src/sys/kern: vfs_syscalls.c Log Message: Ignore the file descriptor argument for absolute pathnames, per posix eg: https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html To generate a diff of this commit: cvs rdiff -u -r1.561 -r1.562 src/sys/kern/vfs_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.561 src/sys/kern/vfs_syscalls.c:1.562 --- src/sys/kern/vfs_syscalls.c:1.561 Sat Sep 9 14:34:44 2023 +++ src/sys/kern/vfs_syscalls.c Sat Jun 29 09:31:07 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.561 2023/09/09 18:34:44 ad Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.562 2024/06/29 13:31:07 christos Exp $ */ /*- * Copyright (c) 2008, 2009, 2019, 2020, 2023 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.561 2023/09/09 18:34:44 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.562 2024/06/29 13:31:07 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -234,8 +234,9 @@ fd_nameiat(struct lwp *l, int fdat, stru { file_t *dfp; int error; + const char *path = pathbuf_stringcopy_get(ndp->ni_pathbuf); - if (fdat != AT_FDCWD) { + if (fdat != AT_FDCWD && path[0] != '/') { if ((error = fd_getvnode(fdat, &dfp)) != 0) goto out; @@ -247,6 +248,7 @@ fd_nameiat(struct lwp *l, int fdat, stru if (fdat != AT_FDCWD) fd_putfile(fdat); out: + pathbuf_stringcopy_put(ndp->ni_pathbuf, path); return error; } @@ -258,7 +260,7 @@ fd_nameiat_simple_user(struct lwp *l, in struct vnode *dvp; int error; - if (fdat != AT_FDCWD) { + if (fdat != AT_FDCWD && path[0] != '/') { if ((error = fd_getvnode(fdat, &dfp)) != 0) goto out;