From: David van Moolenbroek Date: Mon, 8 Mar 2010 22:05:27 +0000 (+0000) Subject: VFS fixes: X-Git-Tag: v3.1.7~249 X-Git-Url: http://zhaoyanbai.com/repos/man.nsec3hash.html?a=commitdiff_plain;h=27d53256e4d2f3eab78aeb35eaa432d3d65895fc;p=minix.git VFS fixes: - do not use uninitialized req_breadwrite results upon failure - improve ".." ELEAVEMOUNT correctness check --- diff --git a/servers/vfs/path.c b/servers/vfs/path.c index d6a1f5580..05706f7b8 100644 --- a/servers/vfs/path.c +++ b/servers/vfs/path.c @@ -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); } diff --git a/servers/vfs/read.c b/servers/vfs/read.c index fb82dcd62..819805a3d 100644 --- a/servers/vfs/read.c +++ b/servers/vfs/read.c @@ -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. */