Skip to content

Commit

Permalink
Cosmetic change to reduce diff with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Villemain authored and Cédric Villemain committed Apr 24, 2011
1 parent 09037ef commit 9a32172
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#
# Makefile
#
# Copyright (c) 2ndQuadrant, 2010-2011
#

repmgrd_OBJS = dbutils.o config.o repmgrd.o log.o strutil.o
repmgr_OBJS = dbutils.o check_dir.o config.o repmgr.o log.o strutil.o
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ is available by checking its version::
repmgr --version
repmgrd --version

You may need to include
the full path of the binary instead, such as this RHEL example::
You may need to include the full path of the binary instead, such as this
RHEL example::

/usr/pgsql-9.0/bin/repmgr --version
/usr/pgsql-9.0/bin/repmgrd --version
Expand Down
21 changes: 11 additions & 10 deletions check_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ create_directory(char *dir)
return false;
}


bool
set_directory_permissions(char *dir)
{
return (chmod(dir, 0700) != 0) ? false : true;
}



/* function from initdb.c */
/* source adapted from FreeBSD /src/bin/mkdir/mkdir.c */

Expand Down Expand Up @@ -220,18 +220,19 @@ mkdir_p(char *path, mode_t omode)
bool
is_pg_dir(char *dir)
{
struct stat sb;
char path_c[8192];
const size_t buf_sz = 8192;
char path[buf_sz];
struct stat sb;
int r;

// test pgdata
sprintf(path_c, "%s/PG_VERSION", dir);
if (stat(path_c, &sb) == 0)
xsnprintf(path, buf_sz, "%s/PG_VERSION", dir)
if (stat(path, &sb) == 0)
return true;

// test tablespace dir
sprintf(path_c, "ls %s/PG_9.0_*/ -I*", dir);
r = system(path_c);
sprintf(path, "ls %s/PG_9.0_*/ -I*", dir);
r = system(path);
if (r == 0)
return true;

Expand Down Expand Up @@ -272,7 +273,7 @@ create_pgdir(char *dir, bool force)
break;
case 2:
/* Present and not empty */
log_warning( _("directory \"%s\" exists but is not empty\n"),
log_warning(_("directory \"%s\" exists but is not empty\n"),
dir);

pg_dir = is_pg_dir(dir);
Expand All @@ -288,7 +289,7 @@ create_pgdir(char *dir, bool force)
}
else if (pg_dir && !force)
{
log_warning( _("\nThis looks like a PostgreSQL directory.\n"
log_warning(_("\nThis looks like a PostgreSQL directory.\n"
"If you are sure you want to clone here, "
"please check there is no PostgreSQL server "
"running and use the --force option\n"));
Expand All @@ -298,7 +299,7 @@ create_pgdir(char *dir, bool force)
return false;
default:
/* Trouble accessing directory */
log_err( _("could not access directory \"%s\": %s\n"),
log_err(_("could not access directory \"%s\": %s\n"),
dir, strerror(errno));
exit(ERR_BAD_CONFIG);
}
Expand Down
5 changes: 2 additions & 3 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

#include "config.h"
#include "log.h"
#include "strutil.h"
#include "repmgr.h"
#include "strutil.h"
#include "log.h"

void
parse_config(const char *config_file, t_configuration_options *options)
Expand Down Expand Up @@ -137,7 +137,6 @@ trim (char *s)
return s;
}


void
parse_line(char *buff, char *name, char *value)
{
Expand Down
8 changes: 3 additions & 5 deletions repmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,13 +1004,12 @@ do_standby_clone(void)
if (r != 0)
{
log_err(_("Couldn't rsync the master...\nYou have to cleanup the destination directory (%s) manually!\n"),
runtime_options.dest_dir);
local_data_directory);
exit(ERR_BAD_RSYNC);
}

/*
* We need to create the pg_xlog sub directory too, I'm reusing a variable
* here.
* We need to create the pg_xlog sub directory too.
*/
if (!create_directory(local_xlog_directory))
{
Expand Down Expand Up @@ -1125,7 +1124,6 @@ do_standby_promote(void)
*/
log_notice(_("%s: restarting server using pg_ctl\n"), progname);
maxlen_snprintf(script, "pg_ctl -D %s -w -m fast restart", data_dir);

r = system(script);
if (r != 0)
{
Expand Down Expand Up @@ -1795,7 +1793,7 @@ check_parameters_for_action(const int action)
* repmgr.conf is useless because we don't have a server running in
* the standby; warn the user, but keep going.
*/
if (!runtime_options.host[0])
if (runtime_options.host == NULL)
{
log_notice(_("You need to use connection parameters to "
"the master when issuing a STANDBY CLONE command."));
Expand Down
1 change: 1 addition & 0 deletions repmgrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ PGconn *myLocalConn = NULL;

/* Primary info */
t_configuration_options primary_options;

PGconn *primaryConn = NULL;

char sqlquery[QUERY_STR_LEN];
Expand Down

0 comments on commit 9a32172

Please sign in to comment.