mirror of https://github.com/mgba-emu/mgba.git
Util: Fix VFile.readline
This commit is contained in:
parent
8eeaa11256
commit
af6ead2c97
|
@ -104,12 +104,13 @@ ssize_t _vfdReadline(struct VFile* vf, char* buffer, size_t size) {
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
while (bytesRead < size - 1) {
|
while (bytesRead < size - 1) {
|
||||||
size_t newRead = read(vfd->fd, &buffer[bytesRead], 1);
|
size_t newRead = read(vfd->fd, &buffer[bytesRead], 1);
|
||||||
bytesRead += newRead;
|
|
||||||
if (!newRead || buffer[bytesRead] == '\n') {
|
if (!newRead || buffer[bytesRead] == '\n') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
bytesRead += newRead;
|
||||||
}
|
}
|
||||||
return buffer[bytesRead] = '\0';
|
buffer[bytesRead] = '\0';
|
||||||
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size) {
|
ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size) {
|
||||||
|
|
Loading…
Reference in New Issue