summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
authorrsc <rsc>2006-09-07 15:34:28 +0000
committerrsc <rsc>2006-09-07 15:34:28 +0000
commit1542186378ba1c53744d19b3f2c8382976bd5d21 (patch)
treefea4b88738d9f431efbc914b083ae016b282ecdb /fs.c
parent0517a730db6e59e31bac11e43fd0ee9de7200b19 (diff)
downloadxv6-labs-1542186378ba1c53744d19b3f2c8382976bd5d21.tar.gz
xv6-labs-1542186378ba1c53744d19b3f2c8382976bd5d21.tar.bz2
xv6-labs-1542186378ba1c53744d19b3f2c8382976bd5d21.zip
allow long names again
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs.c b/fs.c
index 9b687fd..f3d28c6 100644
--- a/fs.c
+++ b/fs.c
@@ -504,8 +504,8 @@ namei(char *path, int mode, uint *ret_off,
uint off, dev;
struct buf *bp;
struct dirent *ep;
- int i, atend;
- unsigned ninum;
+ int i, l, atend;
+ uint ninum;
if(ret_off)
*ret_off = 0xffffffff;
@@ -544,10 +544,9 @@ namei(char *path, int mode, uint *ret_off,
for(i = 0; cp[i] != 0 && cp[i] != '/'; i++)
;
- if(i > DIRSIZ){
- iput(dp);
- return 0;
- }
+ l = i;
+ if(i > DIRSIZ)
+ l = DIRSIZ;
for(off = 0; off < dp->size; off += BSIZE){
bp = bread(dp->dev, bmap(dp, off / BSIZE));
@@ -556,8 +555,8 @@ namei(char *path, int mode, uint *ret_off,
ep++){
if(ep->inum == 0)
continue;
- if(memcmp(cp, ep->name, i) == 0 &&
- (i == DIRSIZ || ep->name[i]== 0)){
+ if(memcmp(cp, ep->name, l) == 0 &&
+ (l == DIRSIZ || ep->name[l]== 0)){
// entry matches path element
off += (uchar*)ep - bp->data;
ninum = ep->inum;