From 2803bb92a85ee3ee256cbf0a8dbefc08a1a4468d Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Sat, 15 Sep 2012 17:32:38 -0500 Subject: [PATCH] Make repmgr compatible with FreeBSD. We need to add an #include and make it use a different path for the "true" binary. Maybe we need to make this changes for all BSD systems but having no evidence of that i prefer to make this only for systems with __FreeBSD__ --- repmgr.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/repmgr.c b/repmgr.c index 68e5db16..16bf0032 100644 --- a/repmgr.c +++ b/repmgr.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -1762,11 +1763,18 @@ test_ssh_connection(char *host, char *remote_user) char script[MAXLEN]; int r; +/* On some OS, true is located in a different place than in Linux */ +#ifdef __FreeBSD__ +#define TRUEBIN_PATH "/usr/bin/true" +#else +#define TRUEBIN_PATH "/bin/true" +#endif + /* Check if we have ssh connectivity to host before trying to rsync */ if (!remote_user[0]) - maxlen_snprintf(script, "ssh -o Batchmode=yes %s /bin/true", host); + maxlen_snprintf(script, "ssh -o Batchmode=yes %s %s", host, TRUEBIN_PATH); else - maxlen_snprintf(script, "ssh -o Batchmode=yes %s -l %s /bin/true", host, remote_user); + maxlen_snprintf(script, "ssh -o Batchmode=yes %s -l %s %s", host, remote_user, TRUEBIN_PATH); log_debug(_("command is: %s"), script); r = system(script);