27#define PG_VERSION_MAX_SIZE 64
53 snprintf(ver_filename,
sizeof(ver_filename),
"%s/PG_VERSION",
56 if ((version_fd = fopen(ver_filename,
"r")) == NULL)
57 pg_fatal(
"could not open version file \"%s\": %m", ver_filename);
59 if (
fstat(fileno(version_fd), &st) != 0)
60 pg_fatal(
"could not stat file \"%s\": %m", ver_filename);
62 pg_fatal(
"file \"%s\" is too large", ver_filename);
64 if (fscanf(version_fd,
"%63s",
buf) == 0 ||
65 sscanf(
buf,
"%d.%d", &v1, &v2) < 1)
66 pg_fatal(
"could not parse version file \"%s\"", ver_filename);
79 return v1 * 10000 + v2 * 100;
void * pg_malloc(size_t size)
#define PG_VERSION_MAX_SIZE
uint32 get_pg_version(const char *datadir, char **version_str)