diff --git a/ft/logger/logger.cc b/ft/logger/logger.cc
index eacec9cb8..1c47a1fdd 100644
--- a/ft/logger/logger.cc
+++ b/ft/logger/logger.cc
@@ -75,10 +75,10 @@ static void toku_print_bytes (FILE *outf, uint32_t len, char *data) {
static bool is_a_logfile_any_version (const char *name, uint64_t *number_result, uint32_t *version_of_log) {
bool rval = true;
- uint64_t result;
- int n;
+ uint64_t result = 0UL;
+ int n = 0;
int r;
- uint32_t version;
+ uint32_t version = 0;
r = sscanf(name, "log%" SCNu64 ".tokulog%" SCNu32 "%n", &result, &version, &n);
if (r!=2 || name[n]!='\0' || version <= TOKU_LOG_VERSION_1) {
//Version 1 does NOT append 'version' to end of '.tokulog'
@@ -644,6 +644,11 @@ int toku_logger_find_logfiles (const char *directory, char ***resultp, int *n_lo
while ((de=readdir(d))) {
uint64_t thisl;
uint32_t version_ignore;
+
+ // if de is directory, skip it
+ if (de->d_type == DT_DIR)
+ continue;
+
if ( !(is_a_logfile_any_version(de->d_name, &thisl, &version_ignore)) ) continue; //#2424: Skip over files that don't match the exact logfile template
if (n_results+1>=result_limit) {
result_limit*=2;
diff --git a/ft/tests/recovery-find-redo-logs.cc b/ft/tests/recovery-find-redo-logs.cc
new file mode 100644
index 000000000..4efe12218
--- /dev/null
+++ b/ft/tests/recovery-find-redo-logs.cc
@@ -0,0 +1,87 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*======
+This file is part of PerconaFT.
+
+
+Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PerconaFT. If not, see .
+
+----------------------------------------
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License, version 3,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with PerconaFT. If not, see .
+======= */
+
+#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+
+// Test that find redo-log files works correctly.
+
+#include "test.h"
+#include
+
+static int
+run_test(void) {
+ int r;
+
+ // setup the test dir
+ toku_os_recursive_delete(TOKU_TEST_FILENAME);
+ r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU);
+ assert(r == 0);
+
+ char testdir[TOKU_PATH_MAX+1];
+ char testfile[TOKU_PATH_MAX+1];
+
+ toku_path_join(testdir, 2, TOKU_TEST_FILENAME, "log002015");
+ r = toku_os_mkdir(testdir, S_IRWXU);
+ assert(r == 0);
+
+ toku_path_join(testfile, 2, TOKU_TEST_FILENAME, "log002015.tokulog27");
+ int fd = open(testfile, O_CREAT+O_WRONLY+O_TRUNC+O_EXCL+O_BINARY, S_IRWXU);
+ assert(fd != -1);
+ close(fd);
+
+ char **logfiles = nullptr;
+ int n_logfiles = 0;
+ r = toku_logger_find_logfiles(TOKU_TEST_FILENAME, &logfiles, &n_logfiles);
+ CKERR(r);
+ assert(n_logfiles == 1);
+ fprintf(stderr, "redo log nums: %d \n", n_logfiles);
+ for (int i; i < n_logfiles; i++) {
+ fprintf(stderr, "redo log %s \n", logfiles[i]);
+ }
+
+ toku_logger_free_logfiles(logfiles, n_logfiles);
+
+ toku_os_recursive_delete(TOKU_TEST_FILENAME);
+
+ return 0;
+}
+
+int
+test_main(int UU(argc), const char *UU(argv[])) {
+ int r;
+ r = run_test();
+ return r;
+}