Simply intends to set expectations around the fact that a config file
is not used *and* doesn't affect anything material about the standby
clone command.
This uses a notion of "logging level" (like NOTICE) that is not yet
seen this program, but I'll probably introduce that soon.
Signed-off-by: Daniel Farina <daniel@heroku.com>
This patch changes raising the error "You need to use connection
parameters to the master when issuing a STANDBY CLONE command." to
only occur when no host (a global variable, that is abused for at
least two purposes, but is okay in this case) is passed, rather than
when no config file is passed, which is fine for standby clone (which
itself is a wrapper for rsync)
Signed-off-by: Daniel Farina <daniel@heroku.com>
Grab the configuration struct changes. It was expeditious to un-do
some of my by-hand line-wrapping that avoids 80 character limit,
though.
Conflicts:
config.c
config.h
repmgr.c
repmgr.h
repmgrd.c
This would cause a consistent panic (exit() call) without reason.
This should not enable any overruns (but check my work).
Signed-off-by: Dan Farina <drfarina@acm.org>
Previously, this print would use memory freed by PQClear previously.
Also allocate/free memory to prevent this tiny memory leak.
Signed-off-by: Dan Farina <drfarina@acm.org>
MAXLEN definitely needed to be bigger to properly format fairly common
connection strings. In addition, the reliance on xsnprintf helps
detect cases where even this buffer is not long enough.
the buffer in parse_config has been made bigger in a bit of sloppy
programming, but what really needs to happen is reporting when a line
cannot be properly parsed/is too big for the buffer. That is just a
kludge.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
This can occur because prior to this, there is a code path that looks
like this:
primaryConn = myLocalConn
CloseConnections will subsequently try to free both with PQFinish.
I'm not sure if this is the right fix -- it's more of hack -- without
more information about design intention.
One reasonable alternative would be to have CloseConnections perform
this check itself. As-is I am pretty sure that this fix leaves a
signal-race (when CloseConnections is called, without the check, in
the interrupt handler) unfixed.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
A result is being cleared while there are still pointers that
refer to datums in it.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
This is done in a separate patch to try and reduce the sound and fury
of the patch that actually did the conversion from sprintf to
snprintf-alikes.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
Move out string operations to another file, and introduce a frontend
to snprintf for various situations. This change is important for
catching and eliminating sprintf overflows, which are as of now many
times silently corrupting memory.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
pgsql conventions (tabs, four-spaces-wide, etc) applied all around.
Also tried to fix some very tiny capitalization errors, auto-fill
problems, and some inter-block vertical whitespacing issues.
Long strings in repmgr.c were left intact, though. They are rather
numerous and are less of a problem than tiny bits of function calls
and comments wrapping over a line; the latter kind of problem has been
mostly fixed.
Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>