diff --git a/lfs.c b/lfs.c index 6088b4e..cddc6fa 100644 --- a/lfs.c +++ b/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 diff --git a/lfs.h b/lfs.h index 815c7d7..7757f8b 100644 --- a/lfs.h +++ b/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 diff --git a/tests/test_dirs.sh b/tests/test_dirs.sh index 5a7ea58..8b69e7e 100755 --- a/tests/test_dirs.sh +++ b/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;