aboutsummaryrefslogtreecommitdiff
path: root/libssh/options.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-02 11:50:23 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-02 11:50:23 +0000
commitd86ac9e04bc5511f7c45406c6cf6e48d43de3626 (patch)
treed8b0b7f3543b048ea03c8a4c65883eb301918831 /libssh/options.c
parent71913c8fea05f4e90277642265667c312f4831ee (diff)
downloadlibssh-d86ac9e04bc5511f7c45406c6cf6e48d43de3626.tar.gz
libssh-d86ac9e04bc5511f7c45406c6cf6e48d43de3626.tar.xz
libssh-d86ac9e04bc5511f7c45406c6cf6e48d43de3626.zip
Improve ssh_options_set_port().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@351 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r--libssh/options.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libssh/options.c b/libssh/options.c
index 77bf1f4..af20d88 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -70,13 +70,24 @@ SSH_OPTIONS *ssh_options_new(void) {
return option;
}
-/** \brief set port to connect or to bind for a connection
- * \param opt options structure
- * \param port port to connect or to bind
+/**
+ * @brief Set port to connect or to bind for a connection.
+ *
+ * @param opt The options structure to use.
+ *
+ * @param port The port to connect or to bind.
+ *
+ * @return 0 on success, < 0 on error.
*/
-void ssh_options_set_port(SSH_OPTIONS *opt, unsigned int port){
- opt->port=port&0xffff;
- opt->bindport=port&0xffff;
+int ssh_options_set_port(SSH_OPTIONS *opt, unsigned int port) {
+ if (opt == NULL) {
+ return -1;
+ }
+
+ opt->port = port & 0xffff;
+ opt->bindport = port & 0xffff;
+
+ return 0;
}
/**