Mon Dec 11 12:42:18 2023 UTC (161d)
pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.


(mlelstv)
diff -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c

cvs diff -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c (expand / switch to unified diff)

--- src/lib/libpuffs/dispatcher.c 2021/03/08 17:34:10 1.49
+++ src/lib/libpuffs/dispatcher.c 2023/12/11 12:42:18 1.50
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $ */ 1/* $NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Development of this software was supported by the 6 * Development of this software was supported by the
7 * Ulla Tuominen Foundation, the Finnish Cultural Foundation and 7 * Ulla Tuominen Foundation, the Finnish Cultural Foundation and
8 * Research Foundation of Helsinki University of Technology. 8 * Research Foundation of Helsinki University of Technology.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if !defined(lint) 33#if !defined(lint)
34__RCSID("$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $"); 34__RCSID("$NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $");
35#endif /* !lint */ 35#endif /* !lint */
36 36
37#include <sys/types.h> 37#include <sys/types.h>
38#include <sys/poll.h> 38#include <sys/poll.h>
39 39
40#include <assert.h> 40#include <assert.h>
41#include <errno.h> 41#include <errno.h>
42#include <pthread.h> 42#include <pthread.h>
43#include <puffs.h> 43#include <puffs.h>
44#include <puffsdump.h> 44#include <puffsdump.h>
45#include <stdio.h> 45#include <stdio.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <unistd.h> 47#include <unistd.h>
@@ -883,27 +883,27 @@ dispatch(struct puffs_cc *pcc) @@ -883,27 +883,27 @@ dispatch(struct puffs_cc *pcc)
883 if (pops->puffs_node_inactive == NULL) { 883 if (pops->puffs_node_inactive == NULL) {
884 error = EOPNOTSUPP; 884 error = EOPNOTSUPP;
885 break; 885 break;
886 } 886 }
887 887
888 error = pops->puffs_node_inactive(pu, opcookie); 888 error = pops->puffs_node_inactive(pu, opcookie);
889 break; 889 break;
890 } 890 }
891 891
892 case PUFFS_VN_PATHCONF: 892 case PUFFS_VN_PATHCONF:
893 { 893 {
894 struct puffs_vnmsg_pathconf *auxt = auxbuf; 894 struct puffs_vnmsg_pathconf *auxt = auxbuf;
895 if (pops->puffs_node_pathconf == NULL) { 895 if (pops->puffs_node_pathconf == NULL) {
896 error = 0; 896 error = EINVAL;
897 break; 897 break;
898 } 898 }
899 899
900 error = pops->puffs_node_pathconf(pu, 900 error = pops->puffs_node_pathconf(pu,
901 opcookie, auxt->pvnr_name, 901 opcookie, auxt->pvnr_name,
902 &auxt->pvnr_retval); 902 &auxt->pvnr_retval);
903 break; 903 break;
904 } 904 }
905 905
906 case PUFFS_VN_ADVLOCK: 906 case PUFFS_VN_ADVLOCK:
907 { 907 {
908 struct puffs_vnmsg_advlock *auxt = auxbuf; 908 struct puffs_vnmsg_advlock *auxt = auxbuf;
909 if (pops->puffs_node_advlock == NULL) { 909 if (pops->puffs_node_advlock == NULL) {