소스 검색

Log an error on win32 if directory listing fails.

svn:r17684
Nick Mathewson 17 년 전
부모
커밋
8d5a9d762c
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      src/common/util.c

+ 5 - 3
src/common/util.c

@@ -2158,9 +2158,11 @@ tor_listdir(const char *dirname)
       smartlist_add(result, tor_strdup(findData.cFileName));
     }
     if (!FindNextFile(handle, &findData)) {
-      if (GetLastError() != ERROR_NO_MORE_FILES) {
-        /* XXX021 can we say what the error is? */
-        log_warn(LD_FS, "Error reading directory '%s'.", dirname);
+      DWORD err;
+      if ((err = GetLastError()) != ERROR_NO_MORE_FILES) {
+        char *errstr = format_win32_error(err);
+        log_warn(LD_FS, "Error reading directory '%s': %s", dirname, errstr);
+        tor_free(errstr);
       }
       break;
     }