Skip to content

Commit

Permalink
Fixed standard name mismatch LFS_ERR_EXISTS -> LFS_ERR_EXIST
Browse files Browse the repository at this point in the history
Matches the standard EEXIST name found on most systems. Other than
this name, all other common constant names were consistent in this
manner.
  • Loading branch information
geky committed Nov 16, 2017
1 parent 843e3c6 commit f9f4f5c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dirs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f9f4f5c

Please sign in to comment.