ref: 92f0726ae3f4bd8bbec8ff934d823e323f5a201f
parent: 123101f0a15381355138315c6215cf81e959784d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jun 28 12:47:24 EDT 2022
9pex: use size, dev and ino in addition to ctim to set qid version
--- a/9pex.c
+++ b/9pex.c
@@ -233,14 +233,24 @@
return -1;
}
+#define copyadvance(p, data, size) do{ memmove(p, data, size); p += size; }while(0)
+
static void
stat2qid(struct stat *st, C9qid *qid, uint32_t *iounit)
{
+ uint8_t b[sizeof(st->st_ctim) + sizeof(st->st_size) + sizeof(st->st_dev) + sizeof(st->st_ino)], *p;
int fmt;
qid->path = st->st_ino;
- qid->version = crc32(&st->st_ctim, sizeof(st->st_ctim));
qid->type = C9qtfile;
+
+ p = b;
+ copyadvance(p, &st->st_ctime, sizeof(st->st_ctim));
+ copyadvance(p, &st->st_size, sizeof(st->st_size));
+ copyadvance(p, &st->st_dev, sizeof(st->st_dev));
+ copyadvance(p, &st->st_ino, sizeof(st->st_ino));
+ qid->version = crc32(b, p-b);
+
fmt = st->st_mode & S_IFMT;
if(fmt == S_IFDIR)
qid->type |= C9qtdir;