- do not use uninitialized req_breadwrite results upon failure
- improve ".." ELEAVEMOUNT correctness check
* 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);
}
} 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. */