simon-svn: putty: simon

Commits to Tartarus CVS repository. tartarus-commits at lists.tartarus.org
Sat Jul 6 21:43:21 BST 2013


SVN root:       svn://svn.tartarus.org/sgt
Changes by:     simon
Revision:       9894
Date:           2013-07-06 21:43:21 +0100 (Sat, 06 Jul 2013)

Log message (20 lines):
Clean up handling of the return value from sftp_find_request. In many
places we simply enforce by assertion that it will match the request
we sent out a moment ago: in fact it can also return NULL, so it makes
more sense to report a proper error message if it doesn't return the
expected value, and while we're at it, have that error message
whatever message was helpfully left in fxp_error() by
sftp_find_request when it failed.

To do this, I've written a centralised function in psftp.c called
sftp_wait_for_reply, which is handed a request that's just been sent
out and deals with the mechanics of waiting for its reply, returning
the reply when it arrives, and aborting with a sensible error if
anything else arrives instead. The numerous sites in psftp.c which
called sftp_find_request have all been rewritten to do this instead,
and as a side effect they now look more sensible. The only other uses
of sftp_find_request were in xfer_*load_gotpkt, which had to be
tweaked in its own way.

While I'm here, also fix memory management in sftp_find_request, which
was freeing its input packet on some but not all error return paths.

Modified files:
U   putty/pscp.c
U   putty/psftp.c
U   putty/sftp.c

Links:
http://svn.tartarus.org/sgt/?rev=9894&view=rev
http://svn.tartarus.org/sgt/putty/pscp.c?rev=9894&r1=9893&r2=9894
http://svn.tartarus.org/sgt/putty/psftp.c?rev=9894&r1=9893&r2=9894
http://svn.tartarus.org/sgt/putty/sftp.c?rev=9894&r1=9893&r2=9894



More information about the tartarus-commits mailing list