Current-Users archive

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

Re: Question about tmpfs



Le 31/10/2013 02:03, Mindaugas Rasiukevicius a écrit :
It is not a bug, but it is potentially error-prone.  I adjusted the code:

http://mail-index.netbsd.org/source-changes/2013/10/31/msg048829.html

Ok. While I'm at it: tmpfs_read() returns EISDIR when the file
is not regular, but a non-regular file is not necessarily a dir.
The code is now consistent with tmpfs_write(). Also, a typo in a
comment.


Index: tmpfs_subr.c
===================================================================
RCS file: /cvsroot/src/sys/fs/tmpfs/tmpfs_subr.c,v
retrieving revision 1.81
diff -u -r1.81 tmpfs_subr.c
--- tmpfs_subr.c        31 Oct 2013 00:59:17 -0000      1.81
+++ tmpfs_subr.c        31 Oct 2013 06:46:48 -0000
@@ -332,7 +332,7 @@
 }

 /*
- * tmpfs_alloc_file: allocate a new file of specified type and adds it
+ * tmpfs_alloc_file: allocate a new file of specified type and add it
  * into the parent directory.
  *
  * => Credentials of the caller are used.
Index: tmpfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/tmpfs/tmpfs_vnops.c,v
retrieving revision 1.104
diff -u -r1.104 tmpfs_vnops.c
--- tmpfs_vnops.c       31 Oct 2013 00:59:17 -0000      1.104
+++ tmpfs_vnops.c       31 Oct 2013 06:46:48 -0000
@@ -536,10 +536,7 @@

        KASSERT(VOP_ISLOCKED(vp));

-       if (vp->v_type != VREG) {
-               return EISDIR;
-       }
-       if (uio->uio_offset < 0) {
+       if (uio->uio_offset < 0 || vp->v_type != VREG) {
                return EINVAL;
        }


Ok/Comments?


Home | Main Index | Thread Index | Old Index