From 683245dfca325cf254e3771b871cfa956ddb34d2 Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 16 Nov 2013 14:25:31 +0100 Subject: [PATCH] Remove clientdir if it already exists --- snapshot_helper/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/snapshot_helper/main.cpp b/snapshot_helper/main.cpp index 97b6eba3..78561599 100644 --- a/snapshot_helper/main.cpp +++ b/snapshot_helper/main.cpp @@ -194,8 +194,17 @@ int main(int argc, char *argv[]) else if(cmd=="test") { std::string clientdir=backupfolder+os_file_sepn()+"testA54hj5luZtlorr494"; - if(os_create_dir(clientdir)) - { + + bool create_dir_rc=os_create_dir(clientdir); + if(!create_dir_rc) + { + remove_subvolume(clientdir+os_file_sepn()+"A"); + remove_subvolume(clientdir+os_file_sepn()+"B"); + os_remove_dir(clientdir); + } + create_dir_rc = create_dir_rc || os_create_dir(clientdir); + if(create_dir_rc) + { if(!create_subvolume(clientdir+os_file_sepn()+"A") ) { std::cout << "Creating test subvolume failed" << std::endl;