From 6436d959e3cc74c30051f61a6c2817f80e3f45ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sun, 3 Mar 2019 22:04:49 +0200 Subject: [PATCH] Fix avrorouter file rotation The avro filenames weren't processed properly which caused them to not work correctly. --- server/modules/routing/avrorouter/avro_client.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_client.cc b/server/modules/routing/avrorouter/avro_client.cc index 1329e3634..e80d171d0 100644 --- a/server/modules/routing/avrorouter/avro_client.cc +++ b/server/modules/routing/avrorouter/avro_client.cc @@ -668,11 +668,12 @@ static std::string get_next_filename(std::string file, std::string dir) { // Find the last and second to last dot auto last = file.find_last_of('.'); - auto almost_last = file.find_last_of('.', last); + auto part = file.substr(0, last); + auto almost_last = part.find_last_of('.'); mxb_assert(last != std::string::npos && almost_last != std::string::npos); // Extract the number between the dots - std::string number_part = file.substr(almost_last + 1, last); + std::string number_part = part.substr(almost_last + 1, std::string::npos); int filenum = strtol(number_part.c_str(), NULL, 10); std::string file_part = file.substr(0, almost_last);