mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
fix: gettimeofday() expects two arguments
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "repmgr.h"
|
#include "repmgr.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
@@ -433,6 +434,7 @@ wait_connection_availability(PGconn *conn, unsigned long timeout)
|
|||||||
fd_set read_set;
|
fd_set read_set;
|
||||||
int sock = PQsocket(conn);
|
int sock = PQsocket(conn);
|
||||||
struct timeval tmout, before, after;
|
struct timeval tmout, before, after;
|
||||||
|
struct timezone tz;
|
||||||
|
|
||||||
/* recalc to microseconds */
|
/* recalc to microseconds */
|
||||||
timeout *= 1000000;
|
timeout *= 1000000;
|
||||||
@@ -463,7 +465,7 @@ wait_connection_availability(PGconn *conn, unsigned long timeout)
|
|||||||
FD_ZERO(&read_set);
|
FD_ZERO(&read_set);
|
||||||
FD_SET(sock, &read_set);
|
FD_SET(sock, &read_set);
|
||||||
|
|
||||||
gettimeofday(&before);
|
gettimeofday(&before, &tz);
|
||||||
if (select(sock, &read_set, NULL, NULL, &tmout) == -1)
|
if (select(sock, &read_set, NULL, NULL, &tmout) == -1)
|
||||||
{
|
{
|
||||||
log_warning(
|
log_warning(
|
||||||
@@ -471,7 +473,7 @@ wait_connection_availability(PGconn *conn, unsigned long timeout)
|
|||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
gettimeofday(&after);
|
gettimeofday(&after, &tz);
|
||||||
|
|
||||||
timeout -= (after.tv_sec * 1000000 + after.tv_usec) -
|
timeout -= (after.tv_sec * 1000000 + after.tv_usec) -
|
||||||
(before.tv_sec * 1000000 + before.tv_usec);
|
(before.tv_sec * 1000000 + before.tv_usec);
|
||||||
|
|||||||
Reference in New Issue
Block a user