Author: arichardson
Date: Fri Nov 15 18:34:30 2019
New Revision: 354739
URL: https://svnweb.freebsd.org/changeset/base/354739

Log:
  makefs: Also set UFS di_birthtime when building on Linux
  
  Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we
  instead populate it with the st_ctime value.
  
  Reviewed By:  emaste
  Differential Revision: https://reviews.freebsd.org/D22386

Modified:
  head/usr.sbin/makefs/ffs.c

Modified: head/usr.sbin/makefs/ffs.c
==============================================================================
--- head/usr.sbin/makefs/ffs.c  Fri Nov 15 18:34:23 2019        (r354738)
+++ head/usr.sbin/makefs/ffs.c  Fri Nov 15 18:34:30 2019        (r354739)
@@ -728,15 +728,22 @@ ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *
        dinp->di_atime = st->st_atime;
        dinp->di_mtime = st->st_mtime;
        dinp->di_ctime = st->st_ctime;
+#if HAVE_STRUCT_STAT_BIRTHTIME
+       dinp->di_birthtime = st->st_birthtime;
+#else
+       dinp->di_birthtime = st->st_ctime;
+#endif
 #if HAVE_STRUCT_STAT_ST_MTIMENSEC
        dinp->di_atimensec = st->st_atimensec;
        dinp->di_mtimensec = st->st_mtimensec;
        dinp->di_ctimensec = st->st_ctimensec;
-#endif
 #if HAVE_STRUCT_STAT_BIRTHTIME
-       dinp->di_birthtime = st->st_birthtime;
        dinp->di_birthnsec = st->st_birthtimensec;
+#else
+       dinp->di_birthnsec = st->st_ctimensec;
 #endif
+#endif
+
                /* not set: di_db, di_ib, di_blocks, di_spare */
 
        membuf = NULL;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to