From db330b9d0b90e16690066f630170dce0bf94effe Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 28 Apr 2013 17:33:48 +0200 Subject: [PATCH] Doesn't exclude anymore system files in Windows. --- HISTORY | 4 +++- mingw.c | 50 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/HISTORY b/HISTORY index 4c4060ca..4b84a454 100644 --- a/HISTORY +++ b/HISTORY @@ -3,7 +3,9 @@ SnapRAID HISTORY 3.1 2013/4 ========== - * Diret use of Windows API for disk access to improve error reporting. + * Direct use of Windows API for disk access to improve error reporting. + * In Windows don't exclude anymore system files. Only system directories are + excluded. 3.0 2013/3 ========== diff --git a/mingw.c b/mingw.c index 23b973f4..b80bcf64 100644 --- a/mingw.c +++ b/mingw.c @@ -312,13 +312,10 @@ static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE if ((info->dwFileAttributes & FILE_ATTRIBUTE_DEVICE) != 0) { st->st_mode = S_IFBLK; st->st_desc = "device"; - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */ - st->st_mode = S_IFCHR; - st->st_desc = "system"; } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) != 0) { /* Offline */ st->st_mode = S_IFCHR; st->st_desc = "offline"; - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Files going to be deleted on close */ + } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Temporary */ st->st_mode = S_IFCHR; st->st_desc = "temporary"; } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { /* Reparse point */ @@ -356,12 +353,22 @@ static void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, const FILE st->st_desc = "reparse-point"; break; } - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { - st->st_mode = S_IFDIR; - st->st_desc = "directory"; + } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */ + if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { + st->st_mode = S_IFCHR; + st->st_desc = "system-directory"; + } else { + st->st_mode = S_IFREG; + st->st_desc = "system-file"; + } } else { - st->st_mode = S_IFREG; - st->st_desc = "regular"; + if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { + st->st_mode = S_IFDIR; + st->st_desc = "directory"; + } else { + st->st_mode = S_IFREG; + st->st_desc = "regular"; + } } /* Store the HIDDEN attribute in a separate field */ @@ -405,13 +412,10 @@ static void windows_finddata2stat(const WIN32_FIND_DATAW* info, struct windows_s if ((info->dwFileAttributes & FILE_ATTRIBUTE_DEVICE) != 0) { st->st_mode = S_IFBLK; st->st_desc = "device"; - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */ - st->st_mode = S_IFCHR; - st->st_desc = "system"; } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) != 0) { /* Offline */ st->st_mode = S_IFCHR; st->st_desc = "offline"; - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Files going to be deleted on close */ + } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0) { /* Temporary */ st->st_mode = S_IFCHR; st->st_desc = "temporary"; } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { /* Reparse point */ @@ -449,12 +453,22 @@ static void windows_finddata2stat(const WIN32_FIND_DATAW* info, struct windows_s st->st_desc = "reparse-point"; break; } - } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { - st->st_mode = S_IFDIR; - st->st_desc = "directory"; + } else if ((info->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) != 0) { /* System */ + if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { + st->st_mode = S_IFCHR; + st->st_desc = "system-directory"; + } else { + st->st_mode = S_IFREG; + st->st_desc = "system-file"; + } } else { - st->st_mode = S_IFREG; - st->st_desc = "regular"; + if ((info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { + st->st_mode = S_IFDIR; + st->st_desc = "directory"; + } else { + st->st_mode = S_IFREG; + st->st_desc = "regular"; + } } /* Store the HIDDEN attribute in a separate field */