This commit is the result of the squash of the following main commits:
Author: Alain Spineux <alain@baculasystems.com>
Date: Mon Nov 12 11:07:04 2018 +0100
win32: Fix #4286 about the restore of a volume root directory with the hidden & system attributes
- Detect root directories like C:\ or C:\mount_point
and setup st_rdev=WIN32_ROOT_POINT to tell restore to not restore
the hidden and system attributes
- Be aware that there is 2 different "directories" (1) the parent
directory like c:\mount_point and (2) the root directory of the volume
that your are attaching to the parent. The attributes that you see is
the attribute of (1) but for drive letters, their is no (1) then
you see always (2) (that are hidden and system).
When VSS snapshot is used
case FT_DIRBEGIN:
case FT_DIREND:
Dmsg2(200, "Make dir mode=%o dir=%s\n", new_mode, attr->ofname);
+ if (is_win32_stream(attr->data_stream) && attr->statp.st_rdev == WIN32_ROOT_POINT) {
+ /* this is a root directory like C:\ or C:\anymountpoint,
+ * don't restore HIDDEN and SYSTEM attributes
+ */
+ new_mode &= ~S_ISVTX; // remove FILE_ATTRIBUTE_HIDDEN
+ new_mode |= S_IRWXO; // remove FILE_ATTRIBUTE_SYSTEM
+ }
if (!makepath(attr, attr->ofname, new_mode, parent_mode, uid, gid, 0)) {
return CF_ERROR;
}