mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +03:00
Assorted fixes to make pg_upgrade build on MSVC.
* 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.
This commit is contained in:
@ -427,9 +427,11 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
|
|||||||
|
|
||||||
fclose(script);
|
fclose(script);
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
|
if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
|
||||||
pg_log(ctx, PG_FATAL, "Could not add execute permission to file: %s\n",
|
pg_log(ctx, PG_FATAL, "Could not add execute permission to file: %s\n",
|
||||||
*deletion_script_file_name);
|
*deletion_script_file_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
check_ok(ctx);
|
check_ok(ctx);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ is_server_running(migratorContext *ctx, const char *datadir)
|
|||||||
|
|
||||||
snprintf(path, sizeof(path), "%s/postmaster.pid", 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)
|
if (errno != ENOENT)
|
||||||
pg_log(ctx, PG_FATAL, "\ncould not open file \"%s\" for reading\n",
|
pg_log(ctx, PG_FATAL, "\ncould not open file \"%s\" for reading\n",
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "pg_upgrade.h"
|
#include "pg_upgrade.h"
|
||||||
|
|
||||||
#include "dynloader.h"
|
|
||||||
#include "storage/bufpage.h"
|
#include "storage/bufpage.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef WIN32
|
|
||||||
#include <shlobj.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libpq-fe.h"
|
#include "libpq-fe.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user