Module Name:    src
Committed By:   manu
Date:           Thu Nov 10 16:21:10 UTC 2011

Modified Files:
        src/lib/libperfuse: ops.c

Log Message:
Return EISDIR for read/write to directories. NetBSD directory read should
instead return a getent(2) output, but is that really used?


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libperfuse/ops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.43 src/lib/libperfuse/ops.c:1.44
--- src/lib/libperfuse/ops.c:1.43	Sun Oct 30 05:11:37 2011
+++ src/lib/libperfuse/ops.c	Thu Nov 10 16:21:09 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.43 2011/10/30 05:11:37 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.44 2011/11/10 16:21:09 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -2954,6 +2954,13 @@ perfuse_node_read(pu, opc, buf, offset, 
 	vap = puffs_pn_getvap((struct puffs_node *)opc);
 	pm = NULL;
 
+	/*
+	 * NetBSD turns that into a getdents(2) output
+	 * We just do a EISDIR as this feature is of little use.
+	 */
+	if (vap->va_type == VDIR)
+		return EISDIR;
+
 	if ((u_quad_t)offset + *resid > vap->va_size)
 		DWARNX("%s %p read %lld@%zu beyond EOF %" PRIu64 "\n",
 		       __func__, (void *)opc, (long long)offset,
@@ -3048,7 +3055,7 @@ perfuse_node_write(pu, opc, buf, offset,
 	pm = NULL;
 
 	if (vap->va_type == VDIR) 
-		return EBADF;
+		return EISDIR;
 
 	/*
 	 * We need to queue write requests in order to avoid

Reply via email to