mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Fix bugs in exec.c that prevented pg_upgrade working in Windows.
Backpatch to 9.2 - code before that is quite different and should not have these defects.
This commit is contained in:
parent
f763b77193
commit
6259678f8f
@ -52,7 +52,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
|||||||
|
|
||||||
old_umask = umask(S_IRWXG | S_IRWXO);
|
old_umask = umask(S_IRWXG | S_IRWXO);
|
||||||
|
|
||||||
written = strlcpy(cmd, SYSTEMQUOTE, strlen(SYSTEMQUOTE));
|
written = strlcpy(cmd, SYSTEMQUOTE, sizeof(cmd));
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
written += vsnprintf(cmd + written, MAXCMDLEN - written, fmt, ap);
|
written += vsnprintf(cmd + written, MAXCMDLEN - written, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@ -95,10 +95,16 @@ exec_prog(const char *log_file, const char *opt_log_file,
|
|||||||
log_file);
|
log_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
/*
|
||||||
|
* Can't do this on Windows, postmaster will still hold the log file
|
||||||
|
* open if the command was "pg_ctl start".
|
||||||
|
*/
|
||||||
if ((log = fopen_priv(log_file, "a+")) == NULL)
|
if ((log = fopen_priv(log_file, "a+")) == NULL)
|
||||||
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
pg_log(PG_FATAL, "cannot write to log file %s\n", log_file);
|
||||||
fprintf(log, "\n\n");
|
fprintf(log, "\n\n");
|
||||||
fclose(log);
|
fclose(log);
|
||||||
|
#endif
|
||||||
|
|
||||||
return result == 0;
|
return result == 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user