浏览代码

Fixed standard name mismatch LFS_ERR_EXISTS -> LFS_ERR_EXIST

Matches the standard EEXIST name found on most systems. Other than
this name, all other common constant names were consistent in this
manner.
Christopher Haster 8 年之前
父节点
当前提交
f9f4f5ccec
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      lfs.c
  2. 1 1
      lfs.h
  3. 1 1
      tests/test_dirs.sh

+ 2 - 2
lfs.c

@@ -819,7 +819,7 @@ int lfs_mkdir(lfs_t *lfs, const char *path) {
     lfs_entry_t entry;
     err = lfs_dir_find(lfs, &cwd, &entry, &path);
     if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) {
-        return err ? err : LFS_ERR_EXISTS;
+        return err ? err : LFS_ERR_EXIST;
     }
 
     // build up new directory
@@ -1219,7 +1219,7 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
     } else if (entry.d.type == LFS_TYPE_DIR) {
         return LFS_ERR_ISDIR;
     } else if (flags & LFS_O_EXCL) {
-        return LFS_ERR_EXISTS;
+        return LFS_ERR_EXIST;
     }
 
     // setup file struct

+ 1 - 1
lfs.h

@@ -45,7 +45,7 @@ enum lfs_error {
     LFS_ERR_IO      = -5,   // Error during device operation
     LFS_ERR_CORRUPT = -52,  // Corrupted
     LFS_ERR_NOENT   = -2,   // No directory entry
-    LFS_ERR_EXISTS  = -17,  // Entry already exists
+    LFS_ERR_EXIST   = -17,  // Entry already exists
     LFS_ERR_NOTDIR  = -20,  // Entry is not a dir
     LFS_ERR_ISDIR   = -21,  // Entry is a dir
     LFS_ERR_INVAL   = -22,  // Invalid parameter

+ 1 - 1
tests/test_dirs.sh

@@ -56,7 +56,7 @@ TEST
 echo "--- Directory failures ---"
 tests/test.py << TEST
     lfs_mount(&lfs, &cfg) => 0;
-    lfs_mkdir(&lfs, "potato") => LFS_ERR_EXISTS;
+    lfs_mkdir(&lfs, "potato") => LFS_ERR_EXIST;
     lfs_dir_open(&lfs, &dir[0], "tomato") => LFS_ERR_NOENT;
     lfs_dir_open(&lfs, &dir[0], "burito") => LFS_ERR_NOTDIR;
     lfs_file_open(&lfs, &file[0], "tomato", LFS_O_RDONLY) => LFS_ERR_NOENT;