diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-13 16:12:42 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-13 16:12:42 -0700 |
| commit | 87430957089fb09911a84d49dffeca71597e50a7 (patch) | |
| tree | 5fcb05d0f72d1d528201d67831d21904ae1a92e6 | |
| parent | ba5b5196cee8c4a8c3ec47854ed9de8b19065ffa (diff) | |
Added null terminator and closed file handler
| -rw-r--r-- | utils.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -167,6 +167,8 @@ char *readfile(int fd) if (len >= capacity) buf = realloc(buf, sizeof(char)*(capacity *= 2)); } + buf[len] = '\0'; + close(fd); return &buf[1]; } |
