summaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-05-29 00:20:14 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-05-29 00:20:14 +0200
commite51798d002cc902aed4032d42afc82c9c69c24be (patch)
treeba26a105960a58b3cd71f879c9801a8c081968e3 /lib/ssh.c
parentb15a17c702eff70c79b384c07d20272c2495d583 (diff)
downloadcurl-e51798d002cc902aed4032d42afc82c9c69c24be.tar.gz
ssh: fix build for libssh2 before 1.2.6
The statvfs functionality was added to libssh2 in that version, so we switch off that functionality when built with older libraries. Fixes #831
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 50a72ac6e..907f646e8 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -102,6 +102,11 @@
have their definition hidden well */
#endif
+#if LIBSSH2_VERSION_NUM >= x010206
+/* libssh2_sftp_statvfs and friends were added in 1.2.6 */
+#define HAS_STATVFS_SUPPORT 1
+#endif
+
#define sftp_libssh2_last_error(s) curlx_ultosi(libssh2_sftp_last_error(s))
#define sftp_libssh2_realpath(s,p,t,m) \
@@ -1365,10 +1370,12 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_QUOTE_UNLINK);
break;
}
+#ifdef HAS_STATVFS_SUPPORT
else if(curl_strnequal(cmd, "statvfs ", 8)) {
state(conn, SSH_SFTP_QUOTE_STATVFS);
break;
}
+#endif
failf(data, "Unknown SFTP command");
Curl_safefree(sshc->quote_path1);
@@ -1619,6 +1626,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_NEXT_QUOTE);
break;
+#ifdef HAS_STATVFS_SUPPORT
case SSH_SFTP_QUOTE_STATVFS:
{
LIBSSH2_SFTP_STATVFS statvfs;
@@ -1670,7 +1678,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_NEXT_QUOTE);
break;
}
-
+#endif
case SSH_SFTP_GETINFO:
{
if(data->set.get_filetime) {