shithub: mc

Download patch

ref: 1aaecac7967767bd585349befe06b2a4beb31d22
parent: d8056a53dcdc39260dad1afacfca22e93facf509
author: Ori Bernstein <[email protected]>
date: Thu Jun 19 16:46:03 EDT 2014

Fix dir-linux to actually keep the offset.

--- a/libstd/dir-linux.myr
+++ b/libstd/dir-linux.myr
@@ -20,6 +20,8 @@
 	const dirclose	: (d : dir# -> void)
 ;;
 
+const Direntoverhead = 20
+
 const diropen = {p
 	var fd
 	var dir
@@ -33,7 +35,6 @@
 	-> `Ok dir
 }
 
-
 const dirread = {d
 	var len
 	var dent
@@ -49,7 +50,7 @@
 	;;
 
 	dent = &d.buf[d.off] castto(dirent64#)
-	namelen = (dent.reclen - 20) castto(size)
+	namelen = (dent.reclen - Direntoverhead) castto(size)
 	d.off += dent.reclen castto(int64)
 	-> `Some sldup(dent.name[:namelen])
 }