The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f6dd01b417dcf247904b4653063f5fb7f22a0878

commit f6dd01b417dcf247904b4653063f5fb7f22a0878
Author:     John Baldwin <[email protected]>
AuthorDate: 2026-06-23 15:51:43 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2026-06-23 15:51:43 +0000

    cd9660: Adjust parsing of timestamps in the extended atttributes record
    
    The extended attribute record includes four different timestamps: file
    creation, file modification, file expiration, and file effective date.
    Only the first two are meaningful for stat(2).  The latter two (if
    handled) would presumably affect if a file is visible for not.
    
    Previously, the logic here was a bit contorted and made use of the
    effective time.  It also seemed to treat the creation time as a change
    time timestamp.
    
    Instead, simplify the logic such that the modification time is set to
    either the modification time (if present), or the creation time.  The
    access and change times are then set to the modification time.
    
    NB: This is not used if RockRidge extensions are present, and makefs
    does not generate the extended attributes record.
    
    Differential Revision:  https://reviews.freebsd.org/D57748
---
 sys/fs/cd9660/cd9660_node.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c
index ce6ec3aa7a1c..747536042ccc 100644
--- a/sys/fs/cd9660/cd9660_node.c
+++ b/sys/fs/cd9660/cd9660_node.c
@@ -177,12 +177,22 @@ cd9660_deftstamp(struct iso_directory_record *isodir, 
struct iso_node *inop,
 
                if (ftype != ISO_FTYPE_HIGH_SIERRA
                    && isonum_711(ap->version) == 1) {
-                       if 
(!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
-                               
cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
-                       if 
(!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
-                               inop->inode.iso_ctime = inop->inode.iso_atime;
-                       if 
(!cd9660_tstamp_conv17(ap->mtime,&inop->inode.iso_mtime))
-                               inop->inode.iso_mtime = inop->inode.iso_ctime;
+                       /*
+                        * The extended attributes include create
+                        * (ctime), modify (mtime), expiration
+                        * (xtime), and effective (ftime) timstamps.
+                        * Only the first two are meaningful for struct
+                        * stat.
+                        */
+                       struct timespec birthtime;
+
+                       if (!cd9660_tstamp_conv17(ap->ctime, &birthtime))
+                               memset(&birthtime, 0, sizeof(birthtime));
+                       if (!cd9660_tstamp_conv17(ap->mtime,
+                           &inop->inode.iso_mtime))
+                               inop->inode.iso_mtime = birthtime;
+                       inop->inode.iso_ctime = inop->inode.iso_mtime;
+                       inop->inode.iso_atime = inop->inode.iso_mtime;
                } else
                        ap = NULL;
        }

Reply via email to