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 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>
- Fix Makefile to include check_dir.c
- Add function mkdir_p that was taken from initdb.c
- Replace some strcpy for assignment to const char * to keep compiler quite
- Add STANDBY_NORMAL to initialize action
- fix typos and add headers needed to compile
- Add checks to test if the directories are useful for us (basically
the checks follow the same approach as initdb does)
- Add connection parameters
- Better use of rsync
- Some more clean up of code
Changes in repmgrd are:
- Add a parameter to allow the user specify an repmgr.conf
- Change the name of the repl_status table for repl_monitor
- Create a repl_status view that also shows lag in time
- Some more clean up of code