ref: 485e21d9b90db9550ab647db29a8f55cc44f18ac
parent: 3a4278cb9c0f9aaf297e3732e4bec73d70a7d53d
author: cinap_lenrek <cinap_lenrek@localhost>
date: Mon Jun 27 07:27:32 EDT 2011
hgfs: honor x-bit in manifest
--- a/sys/src/cmd/hgfs/dat.h
+++ b/sys/src/cmd/hgfs/dat.h
@@ -51,6 +51,8 @@
Revnode *up;
Revnode *next;
Revnode *down;
+
+ char mode;
};
struct Revinfo
--- a/sys/src/cmd/hgfs/fs.c
+++ b/sys/src/cmd/hgfs/fs.c
@@ -219,6 +219,8 @@
case Qtree:
nd = aux;
d->name = estrdup9p(nd->name);
+ if(nd->mode == 'x')
+ d->mode |= 0111;
if(nd->hash){char path[MAXPATH];
Revlog rl;
--- a/sys/src/cmd/hgfs/tree.c
+++ b/sys/src/cmd/hgfs/tree.c
@@ -44,7 +44,7 @@
}
static void
-addnode(Revnode *d, char *path, uchar *hash)
+addnode(Revnode *d, char *path, uchar *hash, char mode)
{char *slash, *x;
Revnode *c, *p;
@@ -61,10 +61,13 @@
c->path = 1;
x = (char*)&c[1];
if(!slash){+ c->mode = mode;
memmove(c->hash = (uchar*)x, hash, HASHSZ);
x += HASHSZ;
- } else
+ }else{+ c->mode = 0;
c->hash = nil;
+ }
strcpy(c->name = x, path);
c->up = d;
c->down = nil;
@@ -117,7 +120,7 @@
static int
loadmanifest(Revnode *root, int fd, Hashstr **ht, int nh)
{- char buf[BUFSZ], *p, *e;
+ char buf[BUFSZ], *p, *e, *x;
uchar hash[HASHSZ];
int n;
@@ -128,15 +131,19 @@
while((p > buf) && (e = memchr(buf, '\n', p - buf))){*e++ = 0;
- strhash(buf + strlen(buf) + 1, hash);
+ x = buf;
+ x += strlen(x) + 1;
+ strhash(x, hash);
+ x += HASHSZ*2;
+
if(ht == nil)
- addnode(root, buf, hash);
+ addnode(root, buf, hash, *x);
else {Hashstr *he;
for(he = ht[hashstr(buf) % nh]; he; he = he->next){ if(strcmp(he->str, buf) == 0){- addnode(root, buf, hash);
+ addnode(root, buf, hash, *x);
break;
}
}
--
⑨