After a mention from Ben Kibbey we now let knownhost_writeline() return the

length of the actual data it returns, excluding the trailing zero. I also
updated the man page for libssh2_knownhost_writeline() accordingly.
This commit is contained in:
Daniel Stenberg 2009-06-14 14:27:15 +02:00
parent 9f5c1caa81
commit 320450201a
2 changed files with 4 additions and 2 deletions

View File

@ -23,7 +23,8 @@ the 'type' output format.
\fIbuflen\fP is the size of the \fIbuffer\fP. See RETURN VALUE about the size.
\fIoutlen\fP must be a pointer to a size_t variable that will get the output
length stored
length of the stored data chunk. The number does not included the trailing
zero!
\fItype\fP specifies what file type it is, and
\fILIBSSH2_KNOWNHOST_FILE_OPENSSH\fP is the only currently supported

View File

@ -728,7 +728,8 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
rc = LIBSSH2_ERROR_BUFFER_TOO_SMALL;
}
*outlen = nlen;
/* we report the full length of the data with the trailing zero excluded */
*outlen = nlen-1;
return rc;
}