From 03c70cc2e629e2ad8dcd5718be0132f17b9b8328 Mon Sep 17 00:00:00 2001 From: rtm Date: Sat, 26 Aug 2006 16:31:05 +0000 Subject: 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 --- fs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs.c') 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); -- cgit v1.2.3