* @brief Check file accessibility with specified mode * * This function checks whether the file specified by path can be accessed * with the given mode. * * @param[in] path The file path to check accessibility * @param[in] mode The access mode to check (read/write/execute permissions) * * @return int Access status: * - 0 if file is accessible with specified mode * - -1 if
| 2429 | * - -1 if file is not accessible |
| 2430 | */ |
| 2431 | int dfs_file_access(const char *path, mode_t mode) |
| 2432 | { |
| 2433 | int ret; |
| 2434 | struct dfs_file file; |
| 2435 | |
| 2436 | dfs_file_init(&file); |
| 2437 | |
| 2438 | if (dfs_file_open(&file, path, O_RDONLY, mode) >= 0) |
| 2439 | { |
| 2440 | ret = 0; |
| 2441 | dfs_file_close(&file); |
| 2442 | } |
| 2443 | else |
| 2444 | { |
| 2445 | ret = -1; |
| 2446 | } |
| 2447 | |
| 2448 | dfs_file_deinit(&file); |
| 2449 | |
| 2450 | return ret; |
| 2451 | } |
| 2452 | |
| 2453 | #ifdef RT_USING_SMART |
| 2454 | /** |
no test coverage detected