Subject: Re: knownhost.c hostline() fix

Re: knownhost.c hostline() fix

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 12 Jun 2009 00:04:29 +0200 (CEST)

On Wed, 10 Jun 2009, Ben Kibbey wrote:

> Sure. glad to help. Here's a minor fix for writing a null byte at the
> end of a line in the known host file:

> - nwrote = fwrite(buffer, 1, wrote, file);
> - if(nwrote != wrote) {
> + nwrote = fprintf(file, "%s", buffer);
> + if(nwrote != wrote-1) {

Thanks, but I think I'll rather just deduct one byte from 'wrote'.

Or perhaps knownhost_writeline() should return the length excluding the zero
anyway? It's mostly an issue for libssh2_knownhost_writeline(). I think I
would expect that as a user of it.

-- 
  / daniel.haxx.se
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-06-12