-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wait_socket: wrong use of difftime()
With reversed arguments it would always return a negative value... Bug: libssh2/libssh2#1
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* Copyright (c) 2004-2007 Sara Golemon <[email protected]> | ||
* Copyright (c) 2009-2011 by Daniel Stenberg | ||
* Copyright (c) 2009-2015 by Daniel Stenberg | ||
* Copyright (c) 2010 Simon Josefsson <[email protected]> | ||
* All rights reserved. | ||
* | ||
|
@@ -601,7 +601,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time) | |
(seconds_to_next == 0 || | ||
seconds_to_next > session->api_timeout)) { | ||
time_t now = time (NULL); | ||
elapsed_ms = (long)(1000*difftime(start_time, now)); | ||
elapsed_ms = (long)(1000*difftime(now, start_time)); | ||
if (elapsed_ms > session->api_timeout) { | ||
session->err_code = LIBSSH2_ERROR_TIMEOUT; | ||
return LIBSSH2_ERROR_TIMEOUT; | ||
|