summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-08-26 16:31:05 +0000
committerrtm <rtm>2006-08-26 16:31:05 +0000
commit03c70cc2e629e2ad8dcd5718be0132f17b9b8328 (patch)
tree222574119db147dfb92dce4f1740c0a908216dda /fs.c
parenta6c28c9779da5f0b98a1698d66eae0708e395e7d (diff)
downloadxv6-labs-03c70cc2e629e2ad8dcd5718be0132f17b9b8328.tar.gz
xv6-labs-03c70cc2e629e2ad8dcd5718be0132f17b9b8328.tar.bz2
xv6-labs-03c70cc2e629e2ad8dcd5718be0132f17b9b8328.zip
consistently ignore more than 14 chars in path component
forbid create or write of existing directory mkdir("d1/d2/d3"), .. should refer to d2, not cwd mkdir increase parent link count
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs.c b/fs.c
index a83e937..6c552e6 100644
--- a/fs.c
+++ b/fs.c
@@ -499,7 +499,10 @@ namei(char *path, int mode, uint *ret_off, char **ret_last, struct inode **ret_i
for(i = 0; i < DIRSIZ && cp[i] != '/' && cp[i]; i++)
if(cp[i] != ep->name[i])
break;
- if((cp[i] == '\0' || cp[i] == '/') && (i >= DIRSIZ || ep->name[i] == '\0')){
+ if((cp[i] == '\0' || cp[i] == '/' || i >= DIRSIZ) &&
+ (i >= DIRSIZ || ep->name[i] == '\0')){
+ while(cp[i] != '\0' && cp[i] != '/')
+ i++;
off += (uchar*)ep - bp->data;
ninum = ep->inum;
brelse(bp);