Skip to content

Commit a34f934

Browse files
author
Yafei Wu
committed
fix: The init command fails without an error message.
1 parent 4cde879 commit a34f934

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/init.c

+21-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,31 @@ do_init(CatalogState *catalogState)
3333
}
3434

3535
/* create backup catalog root directory */
36-
dir_create_dir(catalogState->catalog_path, DIR_PERMISSION, false);
36+
results = dir_create_dir(catalogState->catalog_path, DIR_PERMISSION, false);
37+
if(results != 0)
38+
{
39+
int errno_tmp = errno;
40+
elog(ERROR, "cannot create backup catalog root directory \"%s\": %s",
41+
catalogState->catalog_path, strerror(errno_tmp));
42+
}
3743

3844
/* create backup catalog data directory */
39-
dir_create_dir(catalogState->backup_subdir_path, DIR_PERMISSION, false);
45+
results = dir_create_dir(catalogState->backup_subdir_path, DIR_PERMISSION, false);
46+
if(results != 0)
47+
{
48+
int errno_tmp = errno;
49+
elog(ERROR, "cannot create backup catalog data directory \"%s\": %s",
50+
catalogState->backup_subdir_path, strerror(errno_tmp));
51+
}
4052

4153
/* create backup catalog wal directory */
42-
dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false);
54+
results = dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false);
55+
if(results != 0)
56+
{
57+
int errno_tmp = errno;
58+
elog(ERROR, "cannot create backup catalog wal directory \"%s\": %s",
59+
catalogState->wal_subdir_path, strerror(errno_tmp));
60+
}
4361

4462
elog(INFO, "Backup catalog '%s' successfully inited", catalogState->catalog_path);
4563
return 0;

0 commit comments

Comments
 (0)