diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index d1ecda80eb..901e19823b 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -18,6 +18,8 @@ #include #include +#define NO_WORKING_DIR "system does not support working dir\n" + /* Global variables */ const struct dfs_filesystem_operation* filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX]; struct dfs_filesystem filesystem_table[DFS_FILESYSTEMS_MAX]; @@ -273,6 +275,7 @@ char* dfs_normalize_path(const char* directory, const char* filename) #else if ((directory == NULL) && (filename[0] != '/')) { + rt_kprintf(NO_WORKING_DIR); return RT_NULL; } #endif diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index fb6a7893da..5939cd680e 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -14,8 +14,6 @@ #include #include -#define NO_WORKING_DIR "system does not support working dir\n" - /** * @addtogroup FileApi */ @@ -43,7 +41,6 @@ int dfs_file_open(struct dfs_fd* fd, const char *path, int flags) fullpath = dfs_normalize_path(RT_NULL, path); if (fullpath == RT_NULL) { - rt_kprintf(NO_WORKING_DIR); return -1; } @@ -213,7 +210,6 @@ int dfs_file_unlink(const char *path) fullpath = dfs_normalize_path(RT_NULL, path); if ( fullpath == RT_NULL) { - rt_kprintf(NO_WORKING_DIR); return -DFS_STATUS_EINVAL; } @@ -327,7 +323,6 @@ int dfs_file_stat(const char *path, struct stat *buf) fullpath = dfs_normalize_path(RT_NULL, path); if ( fullpath == RT_NULL ) { - rt_kprintf(NO_WORKING_DIR); return -1; } @@ -395,7 +390,6 @@ int dfs_file_rename(const char* oldpath, const char* newpath) oldfullpath = dfs_normalize_path(RT_NULL, oldpath); if ( oldfullpath == RT_NULL ) { - rt_kprintf(NO_WORKING_DIR); result = -DFS_STATUS_ENOENT; goto __exit; } @@ -403,7 +397,6 @@ int dfs_file_rename(const char* oldpath, const char* newpath) newfullpath = dfs_normalize_path(RT_NULL, newpath); if ( newfullpath == RT_NULL ) { - rt_kprintf(NO_WORKING_DIR); result = -DFS_STATUS_ENOENT; goto __exit; }