]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS fixes:
authorDavid van Moolenbroek <david@minix3.org>
Mon, 8 Mar 2010 22:05:27 +0000 (22:05 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 8 Mar 2010 22:05:27 +0000 (22:05 +0000)
- do not use uninitialized req_breadwrite results upon failure
- improve ".." ELEAVEMOUNT correctness check

servers/vfs/path.c
servers/vfs/read.c

index d6a1f5580ffde812a3023da3ed3c1324a370e0eb..05706f7b88338e3fc096fa0e6638f83c0eb3ff8c 100644 (file)
@@ -262,7 +262,8 @@ node_details_t *node;
                 * to the parent FS. That is, when we climb up the tree, we
                 * must've encountered ".." in the path, and that is exactly
                 * what we're going to feed to the parent */
-               if(strncmp(user_fullpath, "..", 2) != 0) {
+               if(strncmp(user_fullpath, "..", 2) != 0 ||
+                       (user_fullpath[2] != '\0' && user_fullpath[2] != '/')) {
                        printf("VFS: bogus path: %s\n", user_fullpath);
                        return(ENOENT);
                }
index fb82dcd62d5fc904fe4ec5041fc4bd0ad6571d4a..819805a3d54b2ab1896f79ac4161baf0bc61d656 100644 (file)
@@ -105,8 +105,10 @@ int rw_flag;                       /* READING or WRITING */
   } else if (block_spec) {             /* Block special files. */
        r = req_breadwrite(vp->v_bfs_e, who_e, vp->v_sdev, position,
                m_in.nbytes, m_in.buffer, rw_flag, &res_pos, &res_cum_io);
-       position = res_pos;
-       cum_io += res_cum_io;
+       if (r == OK) {
+               position = res_pos;
+               cum_io += res_cum_io;
+       }
   } else {                             /* Regular files */
        if (rw_flag == WRITING && block_spec == 0) {
                /* Check for O_APPEND flag. */