cURL / Mailing Lists / curl-library / Single Mail


bug: spurious error message when connecting via ssh with non-empty known hosts file

From: <>
Date: Sat, 26 Feb 2011 00:29:37 -0800


(a) the CURLOPT_VERBOSE option is enabled, and

(b) there are one or more hosts in the ssh known hosts file, and

(c) an attempt is made to connect via ssh (indirectly via SFTP in my case),

then a spurious error message is printed to the console:

"* Failed to read known hosts from /<snip>/.ssh/known_hosts"

I've tracked this down to the following bit of code in ssh_connect() [ssh.c]:

/* read all known hosts from there */
rc = libssh2_knownhost_readfile(ssh->kh,

if(rc) {
    infof(data, "Failed to read known hosts from %s\n",

rc should be tested for negativity, not zero, ie.

if(rc<0) {

since libssh2_knownhost_readfile() returns negative values for errors, and non-negative values otherwise.

List admin:
Received on 2011-02-26