mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Fixed incorrect return value from lfs_file_seek
lfs_file_seek returned the _previous_ file offset on success, where most standards return the _calculated_ offset on success. This just falls into me not noticing a mistake, and shows why it's always helpful to have a second set of eyes on code.
This commit is contained in:
		
							
								
								
									
										4
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -1522,8 +1522,6 @@ lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file, | ||||
|     } | ||||
|  | ||||
|     // update pos | ||||
|     lfs_off_t pos = file->pos; | ||||
|  | ||||
|     if (whence == LFS_SEEK_SET) { | ||||
|         file->pos = off; | ||||
|     } else if (whence == LFS_SEEK_CUR) { | ||||
| @@ -1540,7 +1538,7 @@ lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file, | ||||
|         file->pos = file->size + off; | ||||
|     } | ||||
|  | ||||
|     return pos; | ||||
|     return file->pos; | ||||
| } | ||||
|  | ||||
| lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user