From 5fb093184c1d35f49beae1f32183dee1c2655b26 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Tue, 22 Oct 2019 00:23:12 +0300 Subject: [PATCH] Fix log filename sorting Borrowed from https://github.com/MariaDB/server/commit/dd939d6f7e57e418a6f80fb9057eef8823beaff6 Replaces #425 --- ft/logger/logger.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ft/logger/logger.cc b/ft/logger/logger.cc index 7258f5552..5b2d1492c 100644 --- a/ft/logger/logger.cc +++ b/ft/logger/logger.cc @@ -671,12 +671,8 @@ int toku_logger_find_logfiles (const char *directory, char ***resultp, int *n_lo snprintf(fname, fnamelen, "%s/%s", directory, de->d_name); result[n_results++] = fname; } - // Return them in increasing order. Set width to allow for newer log file names ("xxx.tokulog13") - // which are one character longer than old log file names ("xxx.tokulog2"). The comparison function - // won't look beyond the terminating NUL, so an extra character in the comparison string doesn't matter. - // Allow room for terminating NUL after "xxx.tokulog13" even if result[0] is of form "xxx.tokulog2." - int width = sizeof(result[0]+2); - qsort(result, n_results, width, logfilenamecompare); + // Return them in increasing order. + qsort(result, n_results, sizeof(result[0]), logfilenamecompare); *resultp = result; *n_logfiles = n_results; result[n_results]=0; // make a trailing null