Subject: Error reporting of libssh2_sftp_xxxx functions.

Error reporting of libssh2_sftp_xxxx functions.

From: Jean-Louis CHARTON <>
Date: Mon, 23 Mar 2009 19:47:58 +0100

Hi all,

I'm quite new to libssh2 and maybe the following problem has already
been discussed (if so, excuse me).

My problem is that if I try to create a directory thanks to
libssh2_sftp_mkdir(), and if the directory already exists on the remote
SSH server, libssh2_sftp_mkdir() fails; which is what I'm expecting so
far; BUT the error returned by libssh2_sftp_last_error() is either 4
(i.e. LIBSSH2_FX_FAILURE) if the SSH server is an openssh running on a
Linux box or 5 (i.e. LIBSSH2_FX_BAD_MESSAGE) if the server is a freeSSHD
server running on a Windows 2003 server box. In both cases, the error
code returned by libssh2_session_last_error() is -31 (i.e.

I was expecting a more accurate error code like
LIBSSH2_FX_FILE_ALREADY_EXISTS or something like that instead.

Any idea?



Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial.
libssh2-devel mailing list
Received on 2009-03-23