]> granicus.if.org Git - postgresql/commitdiff
Assorted fixes to make pg_upgrade build on MSVC.
authorMagnus Hagander <magnus@hagander.net>
Thu, 13 May 2010 15:58:15 +0000 (15:58 +0000)
committerMagnus Hagander <magnus@hagander.net>
Thu, 13 May 2010 15:58:15 +0000 (15:58 +0000)
* There is no chmod() on Windows.
* Must always use the 3-parameter version of open()
* There is no dynloader.h - but it also appears unnecessary on all platforms
* Don't include shlobj.h because it causes compile errors, and from what I can
  see it's not actually used. This may need to be added back for mingw
  and/or cygwin in the worst case.

contrib/pg_upgrade/check.c
contrib/pg_upgrade/exec.c
contrib/pg_upgrade/page.c
contrib/pg_upgrade/pg_upgrade.h

index 9b2a398082529c0f2bab228b03ba09dd5e12e4af..b3094534c96348c6c815fabb7673ad9b18a8499b 100644 (file)
@@ -427,9 +427,11 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
 
        fclose(script);
 
+#ifndef WIN32
        if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
                pg_log(ctx, PG_FATAL, "Could not add execute permission to file:  %s\n",
                                *deletion_script_file_name);
+#endif
 
        check_ok(ctx);
 }
index 8765d7e41bc8e16596fe94bc3267be26db7d4cd0..d8661a2d3816389640b6d9a979d5b77c5a981de6 100644 (file)
@@ -122,7 +122,7 @@ is_server_running(migratorContext *ctx, const char *datadir)
 
        snprintf(path, sizeof(path), "%s/postmaster.pid", datadir);
 
-       if ((fd = open(path, O_RDONLY)) < 0)
+       if ((fd = open(path, O_RDONLY, 0)) < 0)
        {
                if (errno != ENOENT)
                        pg_log(ctx, PG_FATAL, "\ncould not open file \"%s\" for reading\n",
index 105198758bc653630094c59e540bbfad5bc04c9d..18b0472eb2083ac4a308306f61468f50c1281eb9 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "pg_upgrade.h"
 
-#include "dynloader.h"
 #include "storage/bufpage.h"
 
 
index 0fd12ef5b9d5ac90ec33cc489b63f694a634db8b..0fa96542b9e227dba473a10f8c632788dba10fd8 100644 (file)
@@ -12,9 +12,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#ifdef WIN32
-#include <shlobj.h>
-#endif
 
 #include "libpq-fe.h"