From 8337de1d72ce76ec3c7329aac1ec352661953017 Mon Sep 17 00:00:00 2001 From: Dennis Maisenbacher Date: Mon, 23 Oct 2023 15:01:53 +0200 Subject: [PATCH] util: Fix segfault when doing a backup with an empty backup_path Revert change of 'util: Fix occurances where back() might be called on an empty string' for `zenfs_tool_backup()`. Otherwise test/utils/0040_backup.sh segfaults when building ZenFS with RocksDB 6.29.fb (c++11). Signed-off-by: Dennis Maisenbacher Signed-off-by: Hans Holmberg --- util/zenfs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/zenfs.cc b/util/zenfs.cc index 4145dddf..25330296 100644 --- a/util/zenfs.cc +++ b/util/zenfs.cc @@ -520,7 +520,7 @@ int zenfs_tool_backup() { } std::string backup_path = FLAGS_backup_path; - AddDirSeparatorAtEnd(backup_path); + if (backup_path.size() > 0 && backup_path.back() != '/') backup_path += "/"; io_status = zenfs_tool_copy_dir(zenFS.get(), backup_path, FileSystem::Default().get(), FLAGS_path); }