author | Rich Felker <dalias@aerifal.cx> | 2014年09月04日 21:37:13 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014年09月04日 21:37:13 -0400 |
commit | 402611c3ba3be5b3b0486835d98e22ac7ced2722 (patch) | |
tree | 306214ea557abff49bbf77fdbe97611f92530044 /src/stdio/fgets.c | |
parent | 49d2c8c6bcf8c926e52c7f510033b6adc31355f5 (diff) | |
download | musl-402611c3ba3be5b3b0486835d98e22ac7ced2722.tar.gz |
-rw-r--r-- | src/stdio/fgets.c | 2 |
diff --git a/src/stdio/fgets.c b/src/stdio/fgets.c index b01a4187..cf5b1039 100644 --- a/src/stdio/fgets.c +++ b/src/stdio/fgets.c @@ -34,7 +34,7 @@ char *fgets(char *restrict s, int n, FILE *restrict f) n--; if ((*p++ = c) == '\n') break; } - *p = 0; + if (s) *p = 0; FUNLOCK(f); |