From 8c4d5cb7b8de43286631eba24aa878fe493cdc78 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 16 Dec 2024 02:18:32 +0100 Subject: [PATCH] push_undo() correctly handle case when tmpdir can not be created (init_undo() fails) --- src/save.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/save.c b/src/save.c index c3c68e1b..40e7135d 100644 --- a/src/save.c +++ b/src/save.c @@ -3567,7 +3567,7 @@ void delete_undo(void) /* create undo directory in XSCHEM_TEMP_DIR */ static void init_undo(void) { - if(!xctx->undo_initialized) { + if(xctx->no_undo == 0 && !xctx->undo_initialized) { /* create undo directory */ if( !my_strdup(_ALLOC_ID_, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { dbg(0, "xinit(): problems creating tmp undo dir, Undo will be disabled\n"); @@ -3588,10 +3588,10 @@ void push_undo(void) FILE *fd; char diff_name[PATH_MAX+100]; /* overflow safe 20161122 */ - if(xctx->no_undo)return; dbg(1, "push_undo(): cur_undo_ptr=%d tail_undo_ptr=%d head_undo_ptr=%d\n", xctx->cur_undo_ptr, xctx->tail_undo_ptr, xctx->head_undo_ptr); init_undo(); + if(xctx->no_undo)return; #if HAS_POPEN==1 my_snprintf(diff_name, S(diff_name), "gzip --fast -c > %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);