summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-06-27 11:27:32 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-06-27 11:27:32 +0000
commit0f61b5506ca74ba7560d3c9834330e28ce307019 (patch)
tree3c3874c76c8a3381dfd3dc4e8d358261ffe9a7ee /sys
parent2b5a7cebc2274c5780e2cf62d3e18d0171773231 (diff)
hgfs: honor x-bit in manifest
Diffstat (limited to 'sys')
-rw-r--r--sys/src/cmd/hgfs/dat.h2
-rw-r--r--sys/src/cmd/hgfs/fs.c2
-rw-r--r--sys/src/cmd/hgfs/tree.c19
3 files changed, 17 insertions, 6 deletions
diff --git a/sys/src/cmd/hgfs/dat.h b/sys/src/cmd/hgfs/dat.h
index 111275649..da19212b2 100644
--- a/sys/src/cmd/hgfs/dat.h
+++ b/sys/src/cmd/hgfs/dat.h
@@ -51,6 +51,8 @@ struct Revnode
Revnode *up;
Revnode *next;
Revnode *down;
+
+ char mode;
};
struct Revinfo
diff --git a/sys/src/cmd/hgfs/fs.c b/sys/src/cmd/hgfs/fs.c
index 0c977d2cc..85f32b5d2 100644
--- a/sys/src/cmd/hgfs/fs.c
+++ b/sys/src/cmd/hgfs/fs.c
@@ -219,6 +219,8 @@ fsmkdir(Dir *d, int level, void *aux)
case Qtree:
nd = aux;
d->name = estrdup9p(nd->name);
+ if(nd->mode == 'x')
+ d->mode |= 0111;
if(nd->hash){
char path[MAXPATH];
Revlog rl;
diff --git a/sys/src/cmd/hgfs/tree.c b/sys/src/cmd/hgfs/tree.c
index cf71b0c4a..6e1d34831 100644
--- a/sys/src/cmd/hgfs/tree.c
+++ b/sys/src/cmd/hgfs/tree.c
@@ -44,7 +44,7 @@ nodepath(char *s, char *e, Revnode *nd)
}
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 @@ addnode(Revnode *d, char *path, uchar *hash)
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 @@ hashstr(char *s)
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 @@ loadmanifest(Revnode *root, int fd, Hashstr **ht, int nh)
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;
}
}