From a8efa5b325a70065b14390dcb8bddef30aa41bec Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Wed, 31 Jul 2013 22:10:11 +0200 Subject: [PATCH] Fixes a directory creation problem in Windows in the root directory. --- HISTORY | 9 +++++++++ util.c | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/HISTORY b/HISTORY index 09fe1a89..3ff89583 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,15 @@ SnapRAID HISTORY ================ +3.2 2013/7 +========== + * Fix a directory creation problem in Windows when the "disk" option points to + the root directory of a drive. Now SnapRAID won't complain about the + inability to create such directory. + If you encouter this problem when trying to recover your data, just upgrade + to this version, and you'll be able to complete the recovering process. + No need to upgrade for platforms different than Windows. + 3.1 2013/5 ========== * Direct use of Windows API for disk access to improve error reporting. diff --git a/util.c b/util.c index 45199493..29210fb8 100644 --- a/util.c +++ b/util.c @@ -696,6 +696,13 @@ int mkancestor(const char* file) return 0; } +#ifdef _WIN32 + if (strlen(dir) == 2 && dir[1] == ':') { + /* it's a drive specification, nothing more to do */ + return 0; + } +#endif + /* try creating it */ if (mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0) { /* just created */