shithub: gefs

Download patch

ref: 1570a56a00b7e19f249ed4b865b438c7ba00934d
parent: f3b230905d394348aae96da2d3140a629902422f
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Dec 16 10:58:51 EST 2021

fs: don't overflow mtime, atime

--- a/fs.c
+++ b/fs.c
@@ -851,7 +851,7 @@
 	d.qid.vers = 0;
 	d.mode = m->perm;
 	d.name = m->name;
-	d.atime = nsec();
+	d.atime = (nsec() + Nsec/2)/Nsec;
 	d.mtime = d.atime;
 	d.length = 0;
 	d.uid = "glenda";
--- a/pack.c
+++ b/pack.c
@@ -151,8 +151,8 @@
 	ev = pack32(&err, ev, eb, d->qid.vers);
 	ev = pack8(&err, ev, eb, d->qid.type);
 	ev = pack32(&err, ev, eb, d->mode);
-	ev = pack64(&err, ev, eb, d->atime*Nsec);
-	ev = pack64(&err, ev, eb, d->mtime*Nsec);
+	ev = pack64(&err, ev, eb, (vlong)d->atime*Nsec);
+	ev = pack64(&err, ev, eb, (vlong)d->mtime*Nsec);
 	ev = pack64(&err, ev, eb, d->length);
 	ev = packstr(&err, ev, eb, d->uid);
 	ev = packstr(&err, ev, eb, d->gid);