summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-06-20 17:37:47 -0400
committerOri Bernstein <ori@eigenstate.org>2014-06-20 17:37:47 -0400
commitc129c9edf109cadc5e78c271855b6594ad0f79a2 (patch)
tree7c4977bb28964af5e3ad8f2bd34dc73c289cfa97
parent0dccb3c895c2f8f1f758b2702e5d5d967c8998c2 (diff)
downloadmc-c129c9edf109cadc5e78c271855b6594ad0f79a2.tar.gz
Compute the directory length
There can be padding at the end of the buffer for alignment. All we can rely on is the '\0' terminator.
-rw-r--r--libstd/dir-linux.myr5
1 files changed, 4 insertions, 1 deletions
diff --git a/libstd/dir-linux.myr b/libstd/dir-linux.myr
index e294969..40c8d24 100644
--- a/libstd/dir-linux.myr
+++ b/libstd/dir-linux.myr
@@ -50,8 +50,11 @@ const dirread = {d
;;
dent = &d.buf[d.off] castto(dirent64#)
- namelen = (dent.reclen - Direntoverhead) castto(size)
+ namelen = 0
d.off += dent.reclen castto(int64)
+ while dent.name[namelen] != 0
+ namelen++
+ ;;
-> `Some sldup(dent.name[:namelen])
}