| File src/utils/fs.c changed (mode: 100644) (index 541295851..d079d6aca) |
| ... |
... |
is_dir_writable(const char path[]) |
| 403 |
403 |
if(ret != ERROR_SUCCESS) |
if(ret != ERROR_SUCCESS) |
| 404 |
404 |
{ |
{ |
| 405 |
405 |
LOG_ERROR_MSG("Failed to get security info"); |
LOG_ERROR_MSG("Failed to get security info"); |
| 406 |
|
LOG_WERROR(GetLastError()); |
|
|
406 |
|
LOG_WERROR(ret); |
|
407 |
|
|
|
408 |
|
/* Some network shares (NAS, Samba, etc.) don't support security |
|
409 |
|
* descriptors, so ACLs tell nothing. Fall back to checking that the path |
|
410 |
|
* is a directory and let the actual operation report real errors. |
|
411 |
|
* FILE_ATTRIBUTE_READONLY on a directory doesn't prevent creating files in |
|
412 |
|
* it (it's often set on share roots), so it's ignored. */ |
|
413 |
|
if(ret == ERROR_NOT_SUPPORTED || ret == ERROR_INVALID_FUNCTION || |
|
414 |
|
ret == ERROR_CALL_NOT_IMPLEMENTED) |
|
415 |
|
{ |
|
416 |
|
wchar_t *utf16_path_fb = utf8_to_utf16(path); |
|
417 |
|
if(utf16_path_fb == NULL) |
|
418 |
|
{ |
|
419 |
|
return 0; |
|
420 |
|
} |
|
421 |
|
const DWORD attrs = GetFileAttributesW(utf16_path_fb); |
|
422 |
|
free(utf16_path_fb); |
|
423 |
|
return attrs != INVALID_FILE_ATTRIBUTES && |
|
424 |
|
(attrs & FILE_ATTRIBUTE_DIRECTORY); |
|
425 |
|
} |
| 407 |
426 |
return 0; |
return 0; |
| 408 |
427 |
} |
} |
| 409 |
428 |
|
|