mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
removed strncmp improper usage, initialise values asap
This commit is contained in:
6
config.c
6
config.c
@@ -30,11 +30,11 @@ parse_config(const char *config_file, char *cluster_name, int *node, char *conni
|
|||||||
parse_line(buff, name, value);
|
parse_line(buff, name, value);
|
||||||
|
|
||||||
/* Copy into correct entry in parameters struct */
|
/* Copy into correct entry in parameters struct */
|
||||||
if (strncmp(name, "cluster", 7) == 0)
|
if (strcmp(name, "cluster") == 0)
|
||||||
strncpy (cluster_name, value, MAXLEN);
|
strncpy (cluster_name, value, MAXLEN);
|
||||||
else if (strncmp(name, "node", 4) == 0)
|
else if (strcmp(name, "node") == 0)
|
||||||
*node = atoi(value);
|
*node = atoi(value);
|
||||||
else if (strncmp(name, "conninfo", 8) == 0)
|
else if (strcmp(name, "conninfo") == 0)
|
||||||
strncpy (conninfo, value, MAXLEN);
|
strncpy (conninfo, value, MAXLEN);
|
||||||
else
|
else
|
||||||
printf ("WARNING: %s/%s: Unknown name/value pair!\n", name, value);
|
printf ("WARNING: %s/%s: Unknown name/value pair!\n", name, value);
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
PGconn *
|
PGconn *
|
||||||
establishDBConnection(const char *conninfo, const bool exit_on_error)
|
establishDBConnection(const char *conninfo, const bool exit_on_error)
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
|
||||||
/* Make a connection to the database */
|
/* Make a connection to the database */
|
||||||
conn = PQconnectdb(conninfo);
|
PGconn *conn = PQconnectdb(conninfo);
|
||||||
|
|
||||||
/* Check to see that the backend connection was successfully made */
|
/* Check to see that the backend connection was successfully made */
|
||||||
if ((PQstatus(conn) != CONNECTION_OK))
|
if ((PQstatus(conn) != CONNECTION_OK))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user