Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libperfuse Return EISDIR for read/write to directories. ...



details:   https://anonhg.NetBSD.org/src/rev/97f74ce2ef3f
branches:  trunk
changeset: 771123:97f74ce2ef3f
user:      manu <manu%NetBSD.org@localhost>
date:      Thu Nov 10 16:21:09 2011 +0000

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

diffstat:

 lib/libperfuse/ops.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 463290c4b146 -r 97f74ce2ef3f lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Thu Nov 10 14:01:11 2011 +0000
+++ b/lib/libperfuse/ops.c      Thu Nov 10 16:21:09 2011 +0000
@@ -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 @@
        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 @@
        pm = NULL;
 
        if (vap->va_type == VDIR) 
-               return EBADF;
+               return EISDIR;
 
        /*
         * We need to queue write requests in order to avoid



Home | Main Index | Thread Index | Old Index