# HG changeset patch
# User Maciej Fijalkowski <fijall@gmail.com>
# Date 2016-08-20 21:05:18
# Node ID 8656dcac4ce9c0cd6ebee2dda079fcbaae86b1b1
# Parent  e1a4015f5e34642e57f44e6a621935cc8c1f6af5

osutil: fix the bug on OS X when we return more in listdir

The pointer arithmetic somehow got ommitted during the recent change to use
a struct.

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -120,13 +120,14 @@ if sys.platform == 'darwin' and ffi is n
                 if skip == name and tp == statmod.S_ISDIR:
                     return []
                 if stat:
-                    mtime = cur.time.tv_sec
+                    mtime = cur.mtime.tv_sec
                     mode = (cur.accessmask & ~lib.S_IFMT)| tp
                     ret.append((name, tp, stat_res(st_mode=mode, st_mtime=mtime,
                                 st_size=cur.datalength)))
                 else:
                     ret.append((name, tp))
-                cur += lgt
+                cur = ffi.cast("val_attrs_t*", int(ffi.cast("intptr_t", cur))
+                    + lgt)
         return ret
 
     def listdir(path, stat=False, skip=None):