VFS fixes:

- do not use uninitialized req_breadwrite results upon failure
- improve ".." ELEAVEMOUNT correctness check
This commit is contained in:
David van Moolenbroek 2010-03-08 22:05:27 +00:00
parent 91655261a1
commit 27d53256e4
2 changed files with 6 additions and 3 deletions

View 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);
}

View 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. */