cURL / Mailing Lists / curl-library / Single Mail


Re: sftp postquote command rename fix/diff question

From: Kristian Gunstone <>
Date: Wed, 9 May 2007 22:20:04 +0200

* Dan Fandrich <> [2007-05-09 20:20:12]:
> On Wed, May 09, 2007 at 10:56:37AM +0200, Kristian Gunstone wrote:
> > However, when I issued the 'rename' command I noticed that I would get
> > an error if the destination file already existed. Pollita(freenode)
> > informed me that this was not a 'bug' in libssh2, but that this was how
> > the standard specified it should respond.
> >
> > Either way, I made a modification in curl (/lib/ssh.c) which would check
> > if the destination file existed, and if it did, unlink it before the
> > rename was issued.
> I'm not sure I like this idea. If it returns an error, the app can always
> send an 'rm' command then another 'rename'. Some applications might not
> want to nuke a file if it already exists.

Yes, I suppose you're right. However, the error returned is
LIBSSH2_FX_FAILURE, or "Operation failed".

This could pretty much be anything unless you actually
called libssh2_sftp_stat from outside libcurl, which would seem to
make libcurl almost redundant for this use.

Do you have a suggestion how I could solve this dilemman or come with a
better general solution?

Also, thank you for submitting my other patch.
And, excuse me for making that post a followup on this message - I made
a mistake there.

> >>> Dan
> --
> The web change of address service
> Let webmasters know that your web site has moved


Kristian Gunstone
Received on 2007-05-09