From 83ab2fbada76d1cbc2c535f0f6b1309eec56cc1a Mon Sep 17 00:00:00 2001 From: shermp <14854761+shermp@users.noreply.github.com> Date: Sat, 14 Nov 2020 14:46:40 +1300 Subject: [PATCH] Make mismatched timestamps non-fatal --- src/minivhd.h | 3 ++- src/minivhd_manage.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/minivhd.h b/src/minivhd.h index 47e30a2..80f0d19 100644 --- a/src/minivhd.h +++ b/src/minivhd.h @@ -95,7 +95,8 @@ bool mvhd_file_is_vhd(FILE* f); * MVHD_ERR_TYPE, MVHD_ERR_TIMESTAMP * If MVHD_ERR_FILE is set, mvhd_errno will be set to the appropriate system errno value * - * \return MVHDMeta pointer. If NULL, check err. + * \return MVHDMeta pointer. If NULL, check err. err may also be set to MVHD_ERR_TIMESTAMP if + * opening a differencing VHD. */ MVHDMeta* mvhd_open(const char* path, bool readonly, int* err); diff --git a/src/minivhd_manage.c b/src/minivhd_manage.c index 9d711cf..fbfe725 100644 --- a/src/minivhd_manage.c +++ b/src/minivhd_manage.c @@ -426,8 +426,9 @@ MVHDMeta* mvhd_open(const char* path, bool readonly, int* err) { goto cleanup_format_buff; } if (vhdm->sparse.par_timestamp != par_mod_ts) { + /* The last-modified timestamp is to fragile to make this a fatal error. + Instead, we inform the caller of the potential problem. */ *err = MVHD_ERR_TIMESTAMP; - goto cleanup_format_buff; } vhdm->parent = mvhd_open(par_path, true, err); if (vhdm->parent == NULL) {