diff options
| author | prife <[email protected]> | 2013-04-03 09:10:49 -0700 |
|---|---|---|
| committer | prife <[email protected]> | 2013-04-03 09:10:49 -0700 |
| commit | e952d55d6d4801ec04bda9364b31387caab9ee90 (patch) | |
| tree | 9484c284ee30960b74132f3dead31e2d62c8f0db /components/dfs/src/dfs.c | |
| parent | 425d26786f0f5569473a99176d3cac9aa1bae5bf (diff) | |
| parent | f95cd9a35456bc88621ff544466329258ff80510 (diff) | |
Merge pull request #70 from geniusgogo/dfs-fixbug
Dfs clean and optimized code
Diffstat (limited to 'components/dfs/src/dfs.c')
| -rw-r--r-- | components/dfs/src/dfs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index fc4d4f847b..e1d78d398c 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -188,11 +188,11 @@ void fd_put(struct dfs_fd *fd) dfs_unlock(); }; -/** +/** * @ingroup Fd * * This function will return whether this file has been opend. - * + * * @param pathname the file path name. * * @return 0 on file has been open successfully, -1 on open failed. @@ -220,7 +220,7 @@ int fd_is_open(const char *pathname) /* get file path name under mounted file system */ if (fs->path[0] == '/' && fs->path[1] == '\0') mountpath = fullpath; - else + else mountpath = fullpath + strlen(fs->path); dfs_lock(); @@ -271,7 +271,7 @@ const char *dfs_subdir(const char *directory, const char *filename) return dir; } -/** +/** * this function will normalize a path according to specified parent directory * and file name. * @@ -308,20 +308,20 @@ char *dfs_normalize_path(const char *directory, const char *filename) return RT_NULL; /* join path and file name */ - rt_snprintf(fullpath, strlen(directory) + strlen(filename) + 2, + rt_snprintf(fullpath, strlen(directory) + strlen(filename) + 2, "%s/%s", directory, filename); } else { fullpath = rt_strdup(filename); /* copy string */ - + if (fullpath == RT_NULL) return RT_NULL; } src = fullpath; dst = fullpath; - + dst0 = dst; while (1) { @@ -380,7 +380,7 @@ up_one: dst --; if (dst < dst0) { - rt_free(fullpath); + rt_free(fullpath); return RT_NULL; } while (dst0 < dst && dst[-1] != '/') |
