[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. 981b6df8069577f6a312adbbf4835872d9519a38

Clint Adams clint at debian.org
Tue Jan 3 02:57:37 UTC 2012


The following commit has been merged in the upstream branch:
commit 77bdbc3d919988bdbbbbb78c89a9ea1959038ea7
Author: Kyle J. McKay <mackyle at gmail.com>
Date:   Mon Dec 19 02:44:00 2011 -0800

    Handle random fts_read fts_statp result for FTS_NOSTAT on __APPLE__
    
    If FTS_NOSTAT is used with fts_open on Darwin, fts_statp is never
    valid, even for directories.  Furthermore, while the returned
    fts_statp value sometimes is NULL in these cases, sometimes it's
    just a random, uninitialized value instead.  Handle this properly
    when __APPLE__ is defined.

diff --git a/libfakeroot.c b/libfakeroot.c
index f7f91ce..4f8979e 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -1550,6 +1550,11 @@ FTSENT *fts_read(FTS *ftsp) {
   }
 #endif /* LIBFAKEROOT_DEBUGGING */
   r=next_fts_read(ftsp);
+#ifdef __APPLE__
+  if (r && ((ftsp->fts_options & FTS_NOSTAT)
+            || r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
+    r->fts_statp = NULL;  /* Otherwise fts_statp may be a random pointer */
+#endif
   if(r && r->fts_statp) {  /* Should we bother checking fts_info here? */
 # if defined(STAT64_SUPPORT) && !defined(__APPLE__)
     SEND_GET_STAT64(r->fts_statp, _STAT_VER);
diff --git a/libfakeroot_inode64.c b/libfakeroot_inode64.c
index 572823b..37b1f16 100644
--- a/libfakeroot_inode64.c
+++ b/libfakeroot_inode64.c
@@ -107,6 +107,11 @@ FTSENT *fts_read$INODE64(FTS *ftsp) {
   }
 #endif /* LIBFAKEROOT_DEBUGGING */
   r=next_fts_read$INODE64(ftsp);
+#ifdef __APPLE__
+  if (r && ((ftsp->fts_options & FTS_NOSTAT)
+            || r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
+    r->fts_statp = NULL;  /* Otherwise fts_statp may be a random pointer */
+#endif
   if(r && r->fts_statp) {  /* Should we bother checking fts_info here? */
     send_get_stat64((struct stat64 *)r->fts_statp);
   }

-- 
fakeroot



More information about the Fakeroot-commits mailing list