Skip to content

Commit

Permalink
Fix various compiler warnings. (#1)
Browse files Browse the repository at this point in the history
Those warnings arised depending on the PostgreSQL
version pg_checksum was built against, specifically
for the functions getControlFile() and syncDataDir(), which
is our own implementation for REL9_6_STABLE and REL_10_STABLE.

Also fix the compiler conditional for getControlFile(), the
version check for 9.6 has one digit too much.
  • Loading branch information
psoo authored and mbanck committed Apr 28, 2018
1 parent 49200b5 commit a81c7c5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pg_checksums.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void updateControlFile(char *DataDir, ControlFileData *ControlFile);
#if PG_VERSION_NUM < 100000
static void syncDataDir(char *DataDir, const char *argv0);
#endif
#if PG_VERSION_NUM < 906000
#if PG_VERSION_NUM < 90600
static ControlFileData *getControlFile(char *DataDir);
#endif

Expand Down Expand Up @@ -268,6 +268,13 @@ scan_directory(char *basedir, char *subdir)
closedir(dir);
}

/*
* getControlFile() needs our own implementation in
* PostgreSQL versiones below 9.6. If built against newer version,
* use the get_controlfile() function provided there.
*/
#if PG_VERSION_NUM < 90600

/*
* Read in the control file.
*/
Expand Down Expand Up @@ -300,6 +307,8 @@ getControlFile(char *DataDir)
return ControlFile;
}

#endif

/*
* Update the control file.
*/
Expand Down Expand Up @@ -377,6 +386,11 @@ updateControlFile(char *DataDir, ControlFileData *ControlFile)
}
}

/*
* syncDataDir() is used on PostgreSQL releases <= 10, only
*/
#if PG_VERSION_NUM < 100000

/*
* Sync target data directory to ensure that modifications are safely on disk.
*
Expand Down Expand Up @@ -431,6 +445,8 @@ syncDataDir(char *DataDir, const char *argv0)
}
}

#endif

int
main(int argc, char *argv[])
{
Expand Down

0 comments on commit a81c7c5

Please sign in to comment.