ref: 036047c24d4fdaeb5f2574adab2909b9a1717a2a
parent: 2b78d49cb789a70e1ba36c353c5f04d2715648b1
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Dec 22 08:24:16 EST 2019
fix dir reading
--- a/9pex.c
+++ b/9pex.c
@@ -532,6 +532,8 @@
}
if (e == NULL) /* eof */
break;
+ if (e->d_name[0] == '.' && (e->d_name[1] == 0 || ((e->d_name[1] == '.' && e->d_name[2] == 0))))
+ continue;
if (fstatat(f->fd, e->d_name, &st, 0) != 0) {
*err = strerror(errno);
@@ -542,10 +544,11 @@
c9stp[num++] = &c9st[i];
}
+ i = num;
if (s9readdir(c, tag, c9stp, &num, &f->diroffset, size) != 0)
return -1;
trace("<- Rread tag=%d ...\n", tag);
- if (num > 0)
+ if (i != num)
seekdir(f->dir, dirpos[num]);
return 0;
@@ -736,6 +739,8 @@
free(wrbuf);
memset(rdbuf, 0, ctx.msize);
free(rdbuf);
+ free(fids);
+ free(rootpath);
return 0;
}