mirror of
https://github.com/libssh2/libssh2.git
synced 2025-10-31 23:30:25 +03:00
_libssh2_error: Support allocating the error message
Before this patch "_libssh2_error" required the error message to be a static string. This patch adds a new function "_libssh2_error_flags" accepting an additional "flags" argument and specifically the flag "LIBSSH2_ERR_FLAG_DUP" indicating that the passed string must be duplicated into the heap. Then, the method "_libssh2_error" has been rewritten to use that new function under the hood. Signed-off-by: Salvador Fandino <sfandino@yahoo.com> Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
This commit is contained in:
committed by
Daniel Stenberg
parent
d441da3086
commit
ad23faaae6
@@ -631,6 +631,7 @@ struct _LIBSSH2_SESSION
|
||||
/* Error tracking */
|
||||
const char *err_msg;
|
||||
int err_code;
|
||||
int err_flags;
|
||||
|
||||
/* struct members for packet-level reading */
|
||||
struct transportpacket packet;
|
||||
@@ -950,6 +951,10 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
|
||||
/* Something very bad is going on */
|
||||
#define LIBSSH2_MAC_INVALID -1
|
||||
|
||||
/* Flags for _libssh2_error_flags */
|
||||
/* Error message is allocated on the heap */
|
||||
#define LIBSSH2_ERR_FLAG_DUP 1
|
||||
|
||||
/* SSH Packet Types -- Defined by internet draft */
|
||||
/* Transport Layer */
|
||||
#define SSH_MSG_DISCONNECT 1
|
||||
|
||||
Reference in New Issue
Block a user