libssh2_session_set_last_error(3)

libssh2_session_set_last_error3

Sets the internal error state

Usage

#include <libssh2.h>
int
libssh2_session_set_last_error(LIBSSH2_SESSION *session,
                               int errcode, const char *errmsg)

Overview

session - Session instance as returned by libssh2_session_init_ex(3)

errcode - One of the error codes as defined in the public libssh2 header file.

errmsg - If not NULL, a copy of the given string is stored inside the session object as the error message.

This function is provided for high level language wrappers (i.e. Python or Perl) and other libraries that may extend libssh2 with additional features while still relying on its error reporting mechanism.

Return value

Numeric error code corresponding to the the Error Code constants.

Releases

6 releases since Debian 9 (Stretch); the text changed 1 time.

  1. 9–12
  2. 13–Arch

Availability

Added in 1.6.1

From libssh2 1.11.1-7 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.