Commit Graph
22 Commits
Author SHA1 Message Date
Ha Thach bba4b53a2d Merge pull request #829 from attermann/file_term
Null termination of file name when max length
2024-07-18 17:22:07 +07:00
Chad Attermann 1b12011507 Null termination of file name when max length
File names are returned unterminated in the edge case where their length
is max size This is due to the fact that strncpy does terminate the
destination string when the source string is greater than or equal to
the specifid maximum length.
2024-07-15 09:01:40 -06:00
Chad Attermann 236e434296 Additionally clearing pointers just in case
Clearing `_file` and `_dir` pointers after freeing on failure to open
just in case close() is later called.

To elaborate, the `_file` and `_dir` pointers are normally freed and
cleared by _close(), but when a failure occurs upon opening, these
pointers were being left orphaned since calling close() after failure to
open doesn't make much sense, and indeed caused serious issues within
lfs.
2024-07-12 13:18:40 -06:00
Chad Attermann 1ce5cf13d2 Fix memory leak on failure to open
Fixes leak of memory caused by failure to free file and directory
structures when open fails.
2024-07-12 12:42:53 -06:00
Steven James 85b6e26dc9 Adafruit_LittleFS_File.cpp::truncate: change default value of ret to
LFS_ERR_ISDIR.
2020-06-26 04:04:44 -04:00
Steven James 4a26462db9 Truncate should return false when performed on a directory. 2020-06-25 11:29:11 -04:00
Steven James 778529c301 Add truncate method to Adafruit_LittleFS_File. 2020-06-25 03:32:04 -04:00
hathach 78464dd6e3 skip lock FS for File name()/isDirectory()/isOpen() 2020-01-07 12:04:50 +07:00
hathach f8cfa3d727 add _lockFS()/_unlockFS() to Adafruit_LittleFS 2020-01-07 11:50:31 +07:00
Henry Gabryjelski 76987ca28e Rename internal lock/unlock APIs 2020-01-06 08:36:08 -08:00
Henry Gabryjelski 2451ae0cb2 make File::operator bool(void) redirect to isOpen() 2020-01-06 08:25:54 -08:00
Henry Gabryjelski d53387455c Remove now-unused private constructor 2020-01-06 08:25:54 -08:00
Henry Gabryjelski d56df88961 remove deprecation 2020-01-06 08:25:54 -08:00
Henry Gabryjelski 39faf9f823 Also serialize Adafruit_LittleFS_File.
This solution appears to work.  However, it does not
follow all best practices.  For example, the use of
friend declarations, and the need to make the lock/unlock
functions in File public (in order to get friend status).
However, it passes the stress test without errors.
2020-01-06 08:25:53 -08:00
hathach b99cae32b6 fix #276 rename macro FILE_READ/WRITE to enum FILE_O_READ/WRITE
to avoid conflict with other filesystem define
2019-05-30 18:09:07 +07:00
hathach 063a668a04 rename lfs namespace 2019-05-29 17:25:40 +07:00
hathach f2e7ef6fc4 revert to use malloc for lfs file/dir data due to lfs pointer matching 2019-05-29 14:58:52 +07:00
hathach 6ca6be16c9 use static instead of malloc file/dir handle for lfs 2019-05-28 16:58:03 +07:00
hathach 616162fe25 refactor lfs 2019-05-27 22:05:55 +07:00
hathach 86d63af7c8 open, read, write seems to work 2019-05-27 21:18:53 +07:00
hathach 1529ed0380 clean up 2019-05-24 23:54:57 +07:00
hathach 87a3907912 rename FileSystem to Adafruit_LittleFS 2019-05-24 23:51:55 +07:00