Skip to content

Commit b081df6

Browse files
committed
[NFS] fix opendir failed issue.
1 parent d2e15a5 commit b081df6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

components/dfs/filesystems/nfs/dfs_nfs.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,12 @@ int nfs_open(struct dfs_fd *file)
750750
if (file->flags & DFS_O_CREAT)
751751
{
752752
if (nfs_mkdir(nfs, file->path, 0755) < 0)
753-
return -1;
753+
return -DFS_STATUS_EAGAIN;
754754
}
755755

756756
/* open directory */
757757
dir = nfs_opendir(nfs, file->path);
758+
if (dir == RT_NULL) return -DFS_STATUS_ENOENT;
758759
file->data = dir;
759760
}
760761
else
@@ -766,20 +767,20 @@ int nfs_open(struct dfs_fd *file)
766767
if (file->flags & DFS_O_CREAT)
767768
{
768769
if (nfs_create(nfs, file->path, 0664) < 0)
769-
return -1;
770+
return -DFS_STATUS_EAGAIN;
770771
}
771772

772773
/* open file (get file handle ) */
773774
fp = rt_malloc(sizeof(nfs_file));
774775
if (fp == RT_NULL)
775-
return -1;
776+
return -DFS_STATUS_ENOMEM;
776777

777778
handle = get_handle(nfs, file->path);
778779
if (handle == RT_NULL)
779780
{
780781
rt_free(fp);
781782

782-
return -1;
783+
return -DFS_STATUS_ENOENT;
783784
}
784785

785786
/* get size of file */
@@ -798,7 +799,7 @@ int nfs_open(struct dfs_fd *file)
798799

799800
/* set private file */
800801
file->data = fp;
801-
file->size = fp->size;
802+
file->size = fp->size;
802803
}
803804

804805
return 0;

0 commit comments

Comments
 (0)