> Would you care to share?
Sure. But beware it's just a quick hack.
diff -r 92a579c6549c src/cmd/9pfuse/main.c
--- a/src/cmd/9pfuse/main.c Mon Dec 12 16:44:50 2011 -0500
+++ b/src/cmd/9pfuse/main.c Mon Jan 02 19:00:00 2012 +0100
@@ -837,6 +837,8 @@
void
fusereadlink(FuseMsg *m)
{
+ int n;
+ uchar *buf;
Dir *d;
CFid *fid;
@@ -852,9 +854,19 @@
replyfuseerrno(m, EINVAL);
return;
}
- replyfuse(m, d->ext, strlen(d->ext));
+ n = d->length;
free(d);
- return;
+ if(n > fusemaxwrite)
+ n = fusemaxwrite;
+ buf = emalloc(n);
+ n = fsread(fid, buf, n);
+ if(n < 0){
+ free(buf);
+ replyfuseerrstr(m);
+ return;
+ }
+ replyfuse(m, buf, n);
+ free(buf);
}
/*
diff -r 92a579c6549c src/cmd/vac/vacfs.c
--- a/src/cmd/vac/vacfs.c Mon Dec 12 16:44:50 2011 -0500
+++ b/src/cmd/vac/vacfs.c Mon Jan 02 19:00:00 2012 +0100
@@ -548,8 +548,6 @@
n = vacdirread(f, buf, off, cnt);
else if(vacfilegetmode(f->file)&ModeDevice)
return vtstrdup("device");
- else if(vacfilegetmode(f->file)&ModeLink)
- return vtstrdup("symbolic link");
else if(vacfilegetmode(f->file)&ModeNamedPipe)
return vtstrdup("named pipe");
else
Then symlinks are working. Now you need to fix the uid/gid
problem and handle devices, named pipes and sockets in 9pserve.
Also, you should apply this patch:
http://codereview.appspot.com/download/issue5500097_1.diff
It fixes two problems:
- fix segfault when the first file is DMSYMLINK or DMDEVICE,
- set the buffer to zero before calling readlink.
Symlinks will not work without this patch.
--
David du Colombier