mirror of
https://github.com/JorjBauer/aiie.git
synced 2025-02-16 14:30:36 +00:00
add SEEK_END
This commit is contained in:
parent
548be14913
commit
7c3afa096c
@ -205,7 +205,6 @@ int NixFileManager::write(int8_t fd, const void *buf, int nbyte)
|
||||
}
|
||||
|
||||
uint32_t pos = fileSeekPositions[fd];
|
||||
|
||||
// open, seek, write, close.
|
||||
ssize_t rv = 0;
|
||||
int ffd = ::open(cachedNames[fd], O_WRONLY|O_CREAT, 0644);
|
||||
@ -279,6 +278,15 @@ int NixFileManager::lseek(int8_t fd, int offset, int whence)
|
||||
return -1;
|
||||
return offset;
|
||||
}
|
||||
// Other cases not supported yet
|
||||
if (whence == SEEK_END) {
|
||||
if (offset==0) {
|
||||
seekToEnd(fd);
|
||||
return fileSeekPositions[fd];
|
||||
}
|
||||
// Otherwise we don't handle this yet - seeking beyond the current end
|
||||
}
|
||||
// Other cases not supported yet
|
||||
printf("FAILED lseek -- type %d offset %d\n", whence, offset);
|
||||
exit(1); // this is an error condition we need to find and fix if it happens
|
||||
return -1;
|
||||
};
|
||||
|
@ -290,7 +290,13 @@ int TeensyFileManager::lseek(int8_t fd, int offset, int whence)
|
||||
return -1;
|
||||
return offset;
|
||||
}
|
||||
// Other cases not supported yet
|
||||
if (whence == SEEK_END && offset==0) {
|
||||
seekToEnd(fd);
|
||||
return fileSeekPositions[fd];
|
||||
}
|
||||
|
||||
// Other cases not supported yet
|
||||
Serial.println("ERROR: lseek called in an unsupported form");
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user