From f9f4f5ccec410944121ca3aee904f2f904f33d45 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 16 Nov 2017 17:50:14 -0600 Subject: [PATCH] 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. --- lfs.c | 4 ++-- lfs.h | 2 +- tests/test_dirs.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lfs.c b/lfs.c index 6088b4e56a2..cddc6fa7ff8 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 815c7d70081..7757f8b9b4a 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 5a7ea58b7ec..8b69e7e8ce5 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;