001-bug_basic_archive_lost_archive_directory.patch
text/x-diff
Filename: 001-bug_basic_archive_lost_archive_directory.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| contrib/basic_archive/basic_archive.c | 22 | 32 |
diff --git a/contrib/basic_archive/basic_archive.c b/contrib/basic_archive/basic_archive.c
index 6c7f985d48b..273fd54dc6d 100644
--- a/contrib/basic_archive/basic_archive.c
+++ b/contrib/basic_archive/basic_archive.c
@@ -94,57 +94,47 @@ _PG_archive_module_init(void)
*/
static bool
check_archive_directory(char **newval, void **extra, GucSource source)
+{
+ return true;
+}
+
+/*
+ * basic_archive_configured
+ *
+ * Checks that archive_directory is not blank and exists.
+ */
+static bool
+basic_archive_configured(ArchiveModuleState *state)
{
struct stat st;
- /*
- * The default value is an empty string, so we have to accept that value.
- * Our check_configured callback also checks for this and prevents
- * archiving from proceeding if it is still empty.
- */
- if (*newval == NULL || *newval[0] == '\0')
- return true;
+ if (archive_directory == NULL || archive_directory[0] == '\0')
+ {
+ arch_module_check_errdetail("%s is not set.",
+ "basic_archive.archive_directory");
+
+ return false;
+ }
/*
* Make sure the file paths won't be too long. The docs indicate that the
* file names to be archived can be up to 64 characters long.
*/
- if (strlen(*newval) + 64 + 2 >= MAXPGPATH)
+ if (strlen(archive_directory) + 64 + 2 >= MAXPGPATH)
{
- GUC_check_errdetail("Archive directory too long.");
+ arch_module_check_errdetail("Archive directory too long.");
return false;
}
- /*
- * Do a basic sanity check that the specified archive directory exists. It
- * could be removed at some point in the future, so we still need to be
- * prepared for it not to exist in the actual archiving logic.
- */
- if (stat(*newval, &st) != 0 || !S_ISDIR(st.st_mode))
+ if (stat(archive_directory, &st) != 0 || !S_ISDIR(st.st_mode))
{
- GUC_check_errdetail("Specified archive directory does not exist.");
+ arch_module_check_errdetail("Specified archive directory does not exist.");
return false;
}
return true;
}
-/*
- * basic_archive_configured
- *
- * Checks that archive_directory is not blank.
- */
-static bool
-basic_archive_configured(ArchiveModuleState *state)
-{
- if (archive_directory != NULL && archive_directory[0] != '\0')
- return true;
-
- arch_module_check_errdetail("%s is not set.",
- "basic_archive.archive_directory");
- return false;
-}
-
/*
* basic_archive_file
*