mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 06:56:28 -05:00
Reduce permission to avoid to spin up disks in Windows
Some checks failed
Some checks failed
This commit is contained in:
parent
65ad555779
commit
bbadcf252f
2 changed files with 18 additions and 3 deletions
|
|
@ -2740,7 +2740,7 @@ static void devattr(uint64_t device, const char* name, const char* wfile, uint64
|
|||
(void)family; /* not available, smartctl uses an internal database to get it */
|
||||
|
||||
/* open the volume */
|
||||
h = CreateFileW(convert(conv_buf, wfile), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 0);
|
||||
h = CreateFileW(convert(conv_buf, wfile), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
DWORD error = GetLastError();
|
||||
windows_errno(error);
|
||||
|
|
@ -3247,9 +3247,14 @@ int devmap(void)
|
|||
HANDLE h;
|
||||
|
||||
/* open the volume */
|
||||
h = CreateFileW(convert(conv_buf, wfile), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 0);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
h = CreateFileW(convert(conv_buf, wfile), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
DWORD error = GetLastError();
|
||||
if (error != ERROR_FILE_NOT_FOUND)
|
||||
log_tag("enumeration:/dev/pd%d::error:%lu\n", i, error);
|
||||
continue;
|
||||
}
|
||||
|
||||
char serial[SMART_MAX];
|
||||
serial[0] = 0;
|
||||
devattr_property(h, serial, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue