No need to use strlen() because the i variable counted the chars read

pull/1831/head
Daniele Forsi IU5HKX 2025-08-05 22:18:54 +02:00
rodzic af4c6ec806
commit d5c5eeff15
1 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -102,17 +102,17 @@ getmyline(int fd, char *buf)
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
if (c == ';') { return i; }
}
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
return strlen(buf);
if (i == 0) { hl_usleep(10 * 1000); }
return i;
}
int