Protect callback function calls from macro substitution
Some structure fields holding callback addresses have the same name as the underlying system function (connect, send, recv). Set parentheses around their reference to suppress a possible macro substitution. Use a macro for connect() on OS/400 to resolve a const/nonconst parameter problem.
This commit is contained in:
parent
8ba6bf2aef
commit
7dcf5ed6fb
@ -688,7 +688,7 @@ libssh2_agent_connect(LIBSSH2_AGENT *agent)
|
||||
int i, rc = -1;
|
||||
for (i = 0; supported_backends[i].name; i++) {
|
||||
agent->ops = supported_backends[i].ops;
|
||||
rc = agent->ops->connect(agent);
|
||||
rc = (agent->ops->connect)(agent);
|
||||
if (!rc)
|
||||
return 0;
|
||||
}
|
||||
|
@ -132,6 +132,11 @@ static inline int writev(int sock, struct iovec *iov, int nvecs)
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __OS400__
|
||||
/* Force parameter type. */
|
||||
#define send(s, b, l, f) send((s), (unsigned char *) (b), (l), (f))
|
||||
#endif
|
||||
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
@ -183,9 +188,9 @@ static inline int writev(int sock, struct iovec *iov, int nvecs)
|
||||
(channel), &(channel)->abstract)
|
||||
|
||||
#define LIBSSH2_SEND_FD(session, fd, buffer, length, flags) \
|
||||
session->send(fd, buffer, length, flags, &session->abstract)
|
||||
(session->send)(fd, buffer, length, flags, &session->abstract)
|
||||
#define LIBSSH2_RECV_FD(session, fd, buffer, length, flags) \
|
||||
session->recv(fd, buffer, length, flags, &session->abstract)
|
||||
(session->recv)(fd, buffer, length, flags, &session->abstract)
|
||||
|
||||
#define LIBSSH2_SEND(session, buffer, length, flags) \
|
||||
LIBSSH2_SEND_FD(session, session->socket_fd, buffer, length, flags)
|
||||
|
Loading…
x
Reference in New Issue
Block a user