From 877ee496b1d4cf6a754d466306eb9c15ae0e0984 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 18 Mar 2008 16:08:55 +0000 Subject: [PATCH] r18930@catbus: nickm | 2008-03-18 12:08:28 -0400 Backport to 0.2.0: Detect errors from directory listing correctly on win32. Bug found by lodger. svn:r14103 --- ChangeLog | 2 ++ src/common/util.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e8d2ffc4f3..5587a4d488 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ Changes in version 0.2.0.22-rc - 2008-03-17 at the BIO used (sometimes) to buffer data for the network. Looking at different BIOs could result in write counts on the order of ULONG_MAX. Fixes bug 614. + - On Windows, correctly detect errors when listing the contents of a + directory. Fix from lodger. o Minor bugfixes (on 0.2.0.x): - Downgrade "sslv3 alert handshake failure" message to INFO. diff --git a/src/common/util.c b/src/common/util.c index e263908c19..6cf7d00f32 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -2096,7 +2096,7 @@ tor_listdir(const char *dirname) size_t pattern_len = strlen(dirname)+16; pattern = tor_malloc(pattern_len); tor_snprintf(pattern, pattern_len, "%s\\*", dirname); - if (!(handle = FindFirstFile(pattern, &findData))) { + if (INVALID_HANDLE_VALUE == (handle = FindFirstFile(pattern, &findData))) { tor_free(pattern); return NULL; }