From 2ba76be6f9d89d993092bad22a788fedf816ce77 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 23 Nov 2021 20:01:17 +0000 Subject: [PATCH] Error-check scan dir tidying --- src/src/spool_mbox.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index e5b9ad79c..8b2aae394 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -219,7 +219,7 @@ if (spool_mbox_ok && !f.no_mbox_unspool) { debug_printf("Unable to opendir(%s): %s\n", mbox_path, strerror(errno)); /* Just in case we still can: */ - rmdir(CS mbox_path); + (void) rmdir(CS mbox_path); return; } /* loop thru dir & delete entries */ @@ -230,13 +230,15 @@ if (spool_mbox_ok && !f.no_mbox_unspool) file_path = string_sprintf("%s/%s", mbox_path, name); debug_printf("unspool_mbox(): unlinking '%s'\n", file_path); - (void) unlink(CS file_path); + if (unlink(CS file_path) != 0) + log_write(0, LOG_MAIN|LOG_PANIC, "unlink(%s): %s", file_path, strerror(errno)); } closedir(tempdir); /* remove directory */ - rmdir(CS mbox_path); + if (rmdir(CS mbox_path) != 0) + log_write(0, LOG_MAIN|LOG_PANIC, "rmdir(%s): %s", mbox_path, strerror(errno)); store_reset(reset_point); } spool_mbox_ok = 0; -- 2.30.2