aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorBernhard R. Link <brlink@debian.org>2009-10-04 14:03:25 +0200
committerAndreas Schneider <mail@cynapses.org>2009-10-05 00:02:43 +0200
commit7c759b961521ecae451b113eaa7531f9c77b0079 (patch)
treea8e4e3d780d6f4ce6c3e045bb1edb16fa7ea78ef /libssh
parentd54e9550da59465d9a795c885e18199122b57ba5 (diff)
downloadlibssh-7c759b961521ecae451b113eaa7531f9c77b0079.tar.gz
libssh-7c759b961521ecae451b113eaa7531f9c77b0079.tar.xz
libssh-7c759b961521ecae451b113eaa7531f9c77b0079.zip
add ssh_set_error_oom and ssh_set_error_invalid
Signed-off-by: Andreas Schneider <mail@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r--libssh/error.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/libssh/error.c b/libssh/error.c
index 392e741..f44bf49 100644
--- a/libssh/error.c
+++ b/libssh/error.c
@@ -41,7 +41,7 @@
*
* @brief Registers an error with a description.
*
- * @param error The class of error.
+ * @param error The place to store the error.
*
* @param code The class of error.
*
@@ -59,6 +59,35 @@ void ssh_set_error(void *error, int code, const char *descr, ...) {
}
/**
+ * @internal
+ *
+ * @brief Registers an out of memory error
+ *
+ * @param error The place to store the error.
+ *
+ */
+void ssh_set_error_oom(void *error) {
+ struct error_struct *err = error;
+
+ strcpy(err->error_buffer, "Out of memory");
+ err->error_code = SSH_FATAL;
+}
+
+/**
+ * @internal
+ *
+ * @brief Registers an out of memory error
+ *
+ * @param error The place to store the error.
+ *
+ * @param function The function the error happened in.
+ *
+ */
+void ssh_set_error_invalid(void *error, const char *function) {
+ ssh_set_error(error, SSH_FATAL, "Invalid argument in %s", function);
+}
+
+/**
* @brief Retrieve the error text message from the last error.
*
* @param error The SSH session pointer.