From a53b7deefe5efe89b7606cd7644766e31d657457 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 11 Dec 2021 12:43:44 +0100 Subject: [PATCH 283/310] makefs: Let apply_specentry() use stampst if set Obtained from: ElectroBSD --- usr.sbin/makefs/walk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/makefs/walk.c b/usr.sbin/makefs/walk.c index 79b68d1d3e19..5978f88dc8d1 100644 --- a/usr.sbin/makefs/walk.c +++ b/usr.sbin/makefs/walk.c @@ -522,11 +522,17 @@ apply_specentry(const char *dir, NODE *specnode, fsnode *dirnode) (long)specnode->st_mtimespec.tv_sec); dirnode->inode->st.st_mtime = specnode->st_mtimespec.tv_sec; dirnode->inode->st.st_atime = specnode->st_mtimespec.tv_sec; - dirnode->inode->st.st_ctime = start_time.tv_sec; + if (stampst.st_ino != 0) + dirnode->inode->st.st_ctime = stampst.st_ctime; + else + dirnode->inode->st.st_ctime = start_time.tv_sec; #if HAVE_STRUCT_STAT_ST_MTIMENSEC dirnode->inode->st.st_mtimensec = specnode->st_mtimespec.tv_nsec; dirnode->inode->st.st_atimensec = specnode->st_mtimespec.tv_nsec; - dirnode->inode->st.st_ctimensec = start_time.tv_nsec; + if (stampst.st_ino != 0) + dirnode->inode->st.st_ctimensec = 0; + else + dirnode->inode->st.st_ctimensec = start_time.tv_nsec; #endif } if (specnode->flags & (F_UID | F_UNAME)) { -- 2.37.1