diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2026-06-23 15:51:43 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2026-06-23 15:51:43 +0000 |
| commit | f6dd01b417dcf247904b4653063f5fb7f22a0878 (patch) | |
| tree | 2df147a538ff409a9c893a36c07a1a3f7443ef21 | |
| parent | c6eb9f16cf0e19b54b382aa44f0c9a7bcec5fc40 (diff) | |
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
| -rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 22 |
1 files 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; } |
