aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-01-13 17:07:44 -0500
committerRuss Cox <rsc@swtch.com>2020-01-13 17:07:44 -0500
commitfa588406f02b5f2adf666211bef03fbee30a61b0 (patch)
treebe9cb463e125a94bd45a2baafc96f68050004617 /src
parent1c78140d83ed1f3a2ced027a64113dcf187971fb (diff)
downloadplan9port-fa588406f02b5f2adf666211bef03fbee30a61b0.tar.gz
plan9port-fa588406f02b5f2adf666211bef03fbee30a61b0.tar.bz2
plan9port-fa588406f02b5f2adf666211bef03fbee30a61b0.zip
9pfuse: do not fswalk("..")
f is open, so walk will fail. The comments say we only need one directory anyway. Fixes #277.
Diffstat (limited to 'src')
-rw-r--r--src/cmd/9pfuse/main.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
index 0df61002..69d1ad75 100644
--- a/src/cmd/9pfuse/main.c
+++ b/src/cmd/9pfuse/main.c
@@ -885,7 +885,7 @@ fusereadlink(FuseMsg *m)
* are stored in m->d,nd,d0.
*/
int canpack(Dir*, uvlong, uchar**, uchar*);
-Dir *dotdirs(CFid*);
+Dir *dotdir(CFid*);
void
fusereaddir(FuseMsg *m)
{
@@ -902,8 +902,8 @@ fusereaddir(FuseMsg *m)
if(in->offset == 0){
fsseek(ff->fid, 0, 0);
free(ff->d0);
- ff->d0 = ff->d = dotdirs(ff->fid);
- ff->nd = 2;
+ ff->d0 = ff->d = dotdir(ff->fid);
+ ff->nd = 1;
}
n = in->size;
if(n > fusemaxwrite)
@@ -944,20 +944,13 @@ out:
* We could add .. too, but it isn't necessary.
*/
Dir*
-dotdirs(CFid *f)
+dotdir(CFid *f)
{
Dir *d;
- CFid *f1;
- d = emalloc(2*sizeof *d);
+ d = emalloc(1*sizeof *d);
d[0].name = ".";
d[0].qid = fsqid(f);
- d[1].name = "..";
- f1 = fswalk(f, "..");
- if(f1){
- d[1].qid = fsqid(f1);
- fsclose(f1);
- }
return d;
}