From b081df6b937360aa53bc27f56066f83c2327167b Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 1 Nov 2014 10:53:44 +0800 Subject: [PATCH] [NFS] fix opendir failed issue. --- components/dfs/filesystems/nfs/dfs_nfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/dfs/filesystems/nfs/dfs_nfs.c b/components/dfs/filesystems/nfs/dfs_nfs.c index 5f03314309..7ff5fef5f7 100644 --- a/components/dfs/filesystems/nfs/dfs_nfs.c +++ b/components/dfs/filesystems/nfs/dfs_nfs.c @@ -750,11 +750,12 @@ int nfs_open(struct dfs_fd *file) if (file->flags & DFS_O_CREAT) { if (nfs_mkdir(nfs, file->path, 0755) < 0) - return -1; + return -DFS_STATUS_EAGAIN; } /* open directory */ dir = nfs_opendir(nfs, file->path); + if (dir == RT_NULL) return -DFS_STATUS_ENOENT; file->data = dir; } else @@ -766,20 +767,20 @@ int nfs_open(struct dfs_fd *file) if (file->flags & DFS_O_CREAT) { if (nfs_create(nfs, file->path, 0664) < 0) - return -1; + return -DFS_STATUS_EAGAIN; } /* open file (get file handle ) */ fp = rt_malloc(sizeof(nfs_file)); if (fp == RT_NULL) - return -1; + return -DFS_STATUS_ENOMEM; handle = get_handle(nfs, file->path); if (handle == RT_NULL) { rt_free(fp); - return -1; + return -DFS_STATUS_ENOENT; } /* get size of file */ @@ -798,7 +799,7 @@ int nfs_open(struct dfs_fd *file) /* set private file */ file->data = fp; - file->size = fp->size; + file->size = fp->size; } return 0;