From efec7c8f76bf3bde80793da77d976c629c4f20e5 Mon Sep 17 00:00:00 2001 From: rrizun Date: Sun, 24 Feb 2008 21:05:01 +0000 Subject: [PATCH] fix curl_multi_timeout bug found on mac git-svn-id: http://s3fs.googlecode.com/svn/trunk@101 df820570-a93a-0410-bd06-b72b767a4274 --- s3fs/s3fs.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/s3fs/s3fs.cpp b/s3fs/s3fs.cpp index 81f27fa..90e97cb 100644 --- a/s3fs/s3fs.cpp +++ b/s3fs/s3fs.cpp @@ -1161,16 +1161,18 @@ s3fs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, time_t milliseconds; VERIFY(curl_multi_timeout(multi_handle.get(), &milliseconds)); - if (milliseconds > 0) { - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 1000*milliseconds; + if (milliseconds != -1) { + if (milliseconds > 0) { + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 1000*milliseconds; - int max_fd; - VERIFY(curl_multi_fdset(multi_handle.get(), &read_fd_set, &write_fd_set, &exc_fd_set, &max_fd)); - - if (select(max_fd + 1, &read_fd_set, &write_fd_set, &exc_fd_set, &timeout) == -1) - Yikes(-errno); + int max_fd; + VERIFY(curl_multi_fdset(multi_handle.get(), &read_fd_set, &write_fd_set, &exc_fd_set, &max_fd)); + + if (select(max_fd + 1, &read_fd_set, &write_fd_set, &exc_fd_set, &timeout) == -1) + Yikes(-errno); + } } while (curl_multi_perform(multi_handle.get(), &running_handles) == CURLM_CALL_MULTI_PERFORM)