Prechádzať zdrojové kódy

fixup: umount: set errno according to POSIX

According to the POSIX.1, we should give a EBUSY on umount(2) of busy
filesystem.

Signed-off-by: Shell <smokewood@qq.com>
Shell 5 mesiacov pred
rodič
commit
8507c38222
1 zmenil súbory, kde vykonal 3 pridanie a 1 odobranie
  1. 3 1
      components/dfs/dfs_v2/src/dfs_fs.c

+ 3 - 1
components/dfs/dfs_v2/src/dfs_fs.c

@@ -346,7 +346,7 @@ int dfs_mount(const char *device_name,
 
 int dfs_umount(const char *specialfile, int flags)
 {
-    int ret = -RT_ERROR;
+    int ret = -1;
     char *fullpath = RT_NULL;
     struct dfs_mnt *mnt = RT_NULL;
 
@@ -374,11 +374,13 @@ int dfs_umount(const char *specialfile, int flags)
                 else
                 {
                     LOG_I("the file system is busy!");
+                    ret = -EBUSY;
                 }
             }
             else
             {
                 LOG_I("the path:%s is not a mountpoint!", fullpath);
+                ret = -EINVAL;
             }
         }
         else