Skip to content

Commit e01bf1b

Browse files
committed
position_fix
Fix for error return from position() Issue #9992
1 parent 4e3523c commit e01bf1b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: libraries/FS/src/FS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bool File::seek(uint32_t pos, SeekMode mode) {
105105

106106
size_t File::position() const {
107107
if (!*this) {
108-
return 0;
108+
return (size_t)-1;
109109
}
110110

111111
return _p->position();

Diff for: libraries/FS/src/FS.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class File : public Stream {
6464
bool seek(uint32_t pos) {
6565
return seek(pos, SeekSet);
6666
}
67-
size_t position() const;
67+
size_t position() const; // returns (size_t)-1 on error
6868
size_t size() const;
6969
bool setBufferSize(size_t size);
7070
void close();

0 commit comments

Comments
 (0)