diff options
author | rofl0r <retnyg@gmx.net> | 2011-08-06 10:51:57 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-07 12:45:54 +0200 |
commit | 1d8a9ddf84071eae0cfb761b5cde49d2e429819d (patch) | |
tree | fb938a4e4c06272aeec1da8d5d6a8669fbe73d2e | |
parent | bea66b6476face16a810585c7cef8e359efb7d9a (diff) | |
download | libssh-1d8a9ddf84071eae0cfb761b5cde49d2e429819d.tar.gz libssh-1d8a9ddf84071eae0cfb761b5cde49d2e429819d.tar.xz libssh-1d8a9ddf84071eae0cfb761b5cde49d2e429819d.zip |
misc: Fix ssh_timeout_update().
(cherry picked from commit c31cac93f3695b81383e65ecc8206fbda7f75d94)
-rw-r--r-- | src/misc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -940,15 +940,15 @@ int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout) { * @param[in] ts pointer to an existing timestamp * @param[in] timeout timeout in milliseconds. Negative values mean infinite * timeout - * @returns remaining time in milliseconds, 0 if elapsed, -1 if never. + * @returns remaining time in milliseconds, 0 if elapsed, -1 if never, + * -2 if option-set-timeout. */ int ssh_timeout_update(struct ssh_timestamp *ts, int timeout){ struct ssh_timestamp now; int ms, ret; - if(timeout == 0) - return 0; - if(timeout==-1) - return -1; + if (timeout <= 0) { + return timeout; + } ssh_timestamp_init(&now); ms = ssh_timestamp_difference(ts,&now); if(ms < 0) |