mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 15:16:29 +00:00
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__
This commit is contained in:
12
repmgr.c
12
repmgr.c
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user