Skip to content

Commit f9f4f5c

Browse files
committed
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.
1 parent 843e3c6 commit f9f4f5c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ int lfs_mkdir(lfs_t *lfs, const char *path) {
819819
lfs_entry_t entry;
820820
err = lfs_dir_find(lfs, &cwd, &entry, &path);
821821
if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) {
822-
return err ? err : LFS_ERR_EXISTS;
822+
return err ? err : LFS_ERR_EXIST;
823823
}
824824

825825
// build up new directory
@@ -1219,7 +1219,7 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
12191219
} else if (entry.d.type == LFS_TYPE_DIR) {
12201220
return LFS_ERR_ISDIR;
12211221
} else if (flags & LFS_O_EXCL) {
1222-
return LFS_ERR_EXISTS;
1222+
return LFS_ERR_EXIST;
12231223
}
12241224

12251225
// setup file struct

lfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum lfs_error {
4545
LFS_ERR_IO = -5, // Error during device operation
4646
LFS_ERR_CORRUPT = -52, // Corrupted
4747
LFS_ERR_NOENT = -2, // No directory entry
48-
LFS_ERR_EXISTS = -17, // Entry already exists
48+
LFS_ERR_EXIST = -17, // Entry already exists
4949
LFS_ERR_NOTDIR = -20, // Entry is not a dir
5050
LFS_ERR_ISDIR = -21, // Entry is a dir
5151
LFS_ERR_INVAL = -22, // Invalid parameter

tests/test_dirs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TEST
5656
echo "--- Directory failures ---"
5757
tests/test.py << TEST
5858
lfs_mount(&lfs, &cfg) => 0;
59-
lfs_mkdir(&lfs, "potato") => LFS_ERR_EXISTS;
59+
lfs_mkdir(&lfs, "potato") => LFS_ERR_EXIST;
6060
lfs_dir_open(&lfs, &dir[0], "tomato") => LFS_ERR_NOENT;
6161
lfs_dir_open(&lfs, &dir[0], "burito") => LFS_ERR_NOTDIR;
6262
lfs_file_open(&lfs, &file[0], "tomato", LFS_O_RDONLY) => LFS_ERR_NOENT;

0 commit comments

Comments
 (0)