Add pg_upgrade check to make sure the user has full access permission in
authorBruce Momjian <bruce@momjian.us>
Mon, 16 May 2011 15:01:29 +0000 (11:01 -0400)
committerBruce Momjian <bruce@momjian.us>
Mon, 16 May 2011 15:01:29 +0000 (11:01 -0400)
the current directory;  if not, throw an error.

contrib/pg_upgrade/exec.c
contrib/pg_upgrade/pg_upgrade.c

index 71e84394e67a3561721f2cf0cdb32211a8e60574..a66aeb03499d68cc169bba0f11003d29d4a263e6 100644 (file)
@@ -93,6 +93,11 @@ is_server_running(const char *datadir)
 void
 verify_directories(void)
 {
+
+   if (access(".", R_OK | W_OK | X_OK) != 0)
+       pg_log(PG_FATAL,
+       "You must have full access permissions in the current directory.\n");
+
    prep_status("Checking old data directory (%s)", old_cluster.pgdata);
    check_data_dir(old_cluster.pgdata);
    check_ok();
index 6eaaa0fb84cd557b327180a7ec23a131c824d4bc..e329dc3efe67c6daa952e412ca1e839ebf8ded3c 100644 (file)
@@ -155,17 +155,13 @@ setup(char *argv0, bool live_check)
 
    /* no postmasters should be running */
    if (!live_check && is_server_running(old_cluster.pgdata))
-   {
        pg_log(PG_FATAL, "There seems to be a postmaster servicing the old cluster.\n"
               "Please shutdown that postmaster and try again.\n");
-   }
 
    /* same goes for the new postmaster */
    if (is_server_running(new_cluster.pgdata))
-   {
        pg_log(PG_FATAL, "There seems to be a postmaster servicing the new cluster.\n"
               "Please shutdown that postmaster and try again.\n");
-   }
 
    /* get path to pg_upgrade executable */
    if (find_my_exec(argv0, exec_path) < 0)