summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-11-06 08:10:46 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-11-06 08:10:46 +0300
commiteaba733177c07876217e698b4fcdfba223cf460e (patch)
tree3620ee042172ae2eac48ca80b262a6dd03ab2ea4
parentchannel-func.c (guile_ssh_channel_get_stream): Fix a warning (diff)
downloadguile-ssh-eaba733177c07876217e698b4fcdfba223cf460e.tar.gz
channel-func.c (_ssh_result_to_symbol): Add assertion, fix warning
* libguile-ssh/channel-func.c (_ssh_result_to_symbol): Assert that the argument is one of the libssh valid return codes. Fix warning related to missed 'return' statement.
-rw-r--r--libguile-ssh/channel-func.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libguile-ssh/channel-func.c b/libguile-ssh/channel-func.c
index a1f63a7..f1e3695 100644
--- a/libguile-ssh/channel-func.c
+++ b/libguile-ssh/channel-func.c
@@ -18,6 +18,7 @@
* along with Guile-SSH. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <assert.h>
#include <libguile.h>
#include <libssh/libssh.h>
#include <libssh/server.h>
@@ -216,6 +217,9 @@ Return value is undefined.\
}
#undef FUNC_NAME
+/* Asserts:
+ - RES is one of the valid contants described in 'libssh.h'.
+ */
SCM
_ssh_result_to_symbol (int res)
{
@@ -227,6 +231,10 @@ _ssh_result_to_symbol (int res)
return scm_from_locale_symbol ("again");
case SSH_ERROR:
return scm_from_locale_symbol ("error");
+
+ default: /* Must not happen. */
+ assert (0);
+ return SCM_BOOL_F;
}
}