]> granicus.if.org Git - postgresql/commitdiff
Fix pg_update to properly test for the data directory's existence on
authorBruce Momjian <bruce@momjian.us>
Sat, 30 Jul 2011 05:50:18 +0000 (01:50 -0400)
committerBruce Momjian <bruce@momjian.us>
Sat, 30 Jul 2011 05:50:55 +0000 (01:50 -0400)
Win32.

Backpatch to 9.1.

contrib/pg_upgrade/exec.c

index 3493696f92f3c237786ebd7d455541a5aba0541d..2f5e76da2dcc3b64e1285791aa3f71853ef6d50f 100644 (file)
@@ -168,7 +168,9 @@ check_data_dir(const char *pg_data)
        {
                struct stat statBuf;
 
-               snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data,
+               snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
+                       /* Win32 can't stat() a directory with a trailing slash. */
+                                *requiredSubdirs[subdirnum] ? "/" : "",
                                 requiredSubdirs[subdirnum]);
 
                if (stat(subDirName, &statBuf) != 0)