shithub: mc

Download patch

ref: a986cbd00e4377d04ae1a4018d278689e209fbbc
parent: 0158f58f2cd9ff08fc4c8e09e6f9ce87281c9c02
author: Ori Bernstein <[email protected]>
date: Fri Jun 20 13:37:47 EDT 2014

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.

--- a/libstd/dir-linux.myr
+++ b/libstd/dir-linux.myr
@@ -50,8 +50,11 @@
 	;;
 
 	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])
 }