diff options
Diffstat (limited to 'userland/libc/stdio/fgets.c')
-rw-r--r-- | userland/libc/stdio/fgets.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/userland/libc/stdio/fgets.c b/userland/libc/stdio/fgets.c index 8e21501..acc89a0 100644 --- a/userland/libc/stdio/fgets.c +++ b/userland/libc/stdio/fgets.c @@ -4,13 +4,16 @@ char *fgets(char *s, int n, FILE *stream) { for (int i = 0; i < n; i++) { char c; fread(&c, 1, 1, stream); - if (stream->has_error) + if (stream->has_error) { return NULL; - if (stream->is_eof) + } + if (stream->is_eof) { return NULL; + } s[i] = c; - if (c == '\n') + if (c == '\n') { break; + } } return s; } |