mirror of
https://github.com/RGBCube/serenity
synced 2025-06-15 20:52:07 +00:00
Minor userland tweaks.
This commit is contained in:
parent
71ed63c91d
commit
c80a1f39ce
2 changed files with 7 additions and 1 deletions
|
@ -9,7 +9,7 @@ int main(int c, char** v)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char buf[16];
|
char buf[128];
|
||||||
ssize_t nread = read(fd, buf, sizeof(buf));
|
ssize_t nread = read(fd, buf, sizeof(buf));
|
||||||
if (nread == 0)
|
if (nread == 0)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,6 +41,12 @@ int main(int c, char** v)
|
||||||
printf("failed to read :(\n");
|
printf("failed to read :(\n");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
if (nread > 2)
|
||||||
|
printf("read %u bytes\n", nread);
|
||||||
|
if (nread > (ssize_t)sizeof(keybuf)) {
|
||||||
|
printf("read() overran the buffer i gave it!\n");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
for (ssize_t i = 0; i < nread; ++i) {
|
for (ssize_t i = 0; i < nread; ++i) {
|
||||||
putchar(keybuf[i]);
|
putchar(keybuf[i]);
|
||||||
if (keybuf[i] != '\n') {
|
if (keybuf[i] != '\n') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue