mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	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.
This commit is contained in:
		
							
								
								
									
										4
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -819,7 +819,7 @@ int lfs_mkdir(lfs_t *lfs, const char *path) { | |||||||
|     lfs_entry_t entry; |     lfs_entry_t entry; | ||||||
|     err = lfs_dir_find(lfs, &cwd, &entry, &path); |     err = lfs_dir_find(lfs, &cwd, &entry, &path); | ||||||
|     if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) { |     if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) { | ||||||
|         return err ? err : LFS_ERR_EXISTS; |         return err ? err : LFS_ERR_EXIST; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // build up new directory |     // 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) { |     } else if (entry.d.type == LFS_TYPE_DIR) { | ||||||
|         return LFS_ERR_ISDIR; |         return LFS_ERR_ISDIR; | ||||||
|     } else if (flags & LFS_O_EXCL) { |     } else if (flags & LFS_O_EXCL) { | ||||||
|         return LFS_ERR_EXISTS; |         return LFS_ERR_EXIST; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // setup file struct |     // setup file struct | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								lfs.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								lfs.h
									
									
									
									
									
								
							| @@ -45,7 +45,7 @@ enum lfs_error { | |||||||
|     LFS_ERR_IO      = -5,   // Error during device operation |     LFS_ERR_IO      = -5,   // Error during device operation | ||||||
|     LFS_ERR_CORRUPT = -52,  // Corrupted |     LFS_ERR_CORRUPT = -52,  // Corrupted | ||||||
|     LFS_ERR_NOENT   = -2,   // No directory entry |     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_NOTDIR  = -20,  // Entry is not a dir | ||||||
|     LFS_ERR_ISDIR   = -21,  // Entry is a dir |     LFS_ERR_ISDIR   = -21,  // Entry is a dir | ||||||
|     LFS_ERR_INVAL   = -22,  // Invalid parameter |     LFS_ERR_INVAL   = -22,  // Invalid parameter | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ TEST | |||||||
| echo "--- Directory failures ---" | echo "--- Directory failures ---" | ||||||
| tests/test.py << TEST | tests/test.py << TEST | ||||||
|     lfs_mount(&lfs, &cfg) => 0; |     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], "tomato") => LFS_ERR_NOENT; | ||||||
|     lfs_dir_open(&lfs, &dir[0], "burito") => LFS_ERR_NOTDIR; |     lfs_dir_open(&lfs, &dir[0], "burito") => LFS_ERR_NOTDIR; | ||||||
|     lfs_file_open(&lfs, &file[0], "tomato", LFS_O_RDONLY) => LFS_ERR_NOENT; |     lfs_file_open(&lfs, &file[0], "tomato", LFS_O_RDONLY) => LFS_ERR_NOENT; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user