From a34f9340b52692c2bcebb8c1c12cff6fcee8bf3b Mon Sep 17 00:00:00 2001 From: Yafei Wu Date: Mon, 7 Nov 2022 16:47:56 +0800 Subject: [PATCH] fix: The init command fails without an error message. --- src/init.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/init.c b/src/init.c index 8773016b5..72a12ce00 100644 --- a/src/init.c +++ b/src/init.c @@ -33,13 +33,31 @@ do_init(CatalogState *catalogState) } /* create backup catalog root directory */ - dir_create_dir(catalogState->catalog_path, DIR_PERMISSION, false); + results = dir_create_dir(catalogState->catalog_path, DIR_PERMISSION, false); + if(results != 0) + { + int errno_tmp = errno; + elog(ERROR, "cannot create backup catalog root directory \"%s\": %s", + catalogState->catalog_path, strerror(errno_tmp)); + } /* create backup catalog data directory */ - dir_create_dir(catalogState->backup_subdir_path, DIR_PERMISSION, false); + results = dir_create_dir(catalogState->backup_subdir_path, DIR_PERMISSION, false); + if(results != 0) + { + int errno_tmp = errno; + elog(ERROR, "cannot create backup catalog data directory \"%s\": %s", + catalogState->backup_subdir_path, strerror(errno_tmp)); + } /* create backup catalog wal directory */ - dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false); + results = dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false); + if(results != 0) + { + int errno_tmp = errno; + elog(ERROR, "cannot create backup catalog wal directory \"%s\": %s", + catalogState->wal_subdir_path, strerror(errno_tmp)); + } elog(INFO, "Backup catalog '%s' successfully inited", catalogState->catalog_path); return 0;