diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-02 11:53:24 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-02 11:53:24 +0000 |
commit | b6fbe97f24f8f8cffdb467f90a2c42d0f36cedfb (patch) | |
tree | 5c46f2e8643330b17a573fd4f0623f32c659910a /libssh/options.c | |
parent | d86ac9e04bc5511f7c45406c6cf6e48d43de3626 (diff) | |
download | libssh-b6fbe97f24f8f8cffdb467f90a2c42d0f36cedfb.tar.gz libssh-b6fbe97f24f8f8cffdb467f90a2c42d0f36cedfb.tar.xz libssh-b6fbe97f24f8f8cffdb467f90a2c42d0f36cedfb.zip |
Improve ssh_options_set_fd().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@352 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/libssh/options.c b/libssh/options.c index af20d88..74a4d31 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -304,16 +304,26 @@ int ssh_options_set_username(SSH_OPTIONS *opt, const char *username) { return 0; } -/** If you wish to open the socket yourself for a reason - * or another, set the file descriptor.\n - * don't forget to use ssh_option_set_hostname() as the hostname - * is used as a key in the known_host mechanism - * \brief set a file descriptor for connection - * \param opt options structure - * \param fd an opened file descriptor to use +/** + * @brief Set a file descriptor for connection. + * + * If you wish to open the socket yourself for a reason or another, set the + * file descriptor. Don't forget to use ssh_option_set_hostname() as the + * hostname is used as a key in the known_host mechanism. + * + * @param opt The options structure to use. + * + * @param fd An opened file descriptor to use. + * + * @return 0 on success, < 0 on error. */ -void ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd){ - opt->fd=fd; +int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd) { + if (opt == NULL) { + return -1; + } + opt->fd = fd; + + return 0; } /** In case your client has multiple IP adresses, select the local address |