diff --git a/src/filereader.c b/src/filereader.c index a98fd81..409e2f3 100644 --- a/src/filereader.c +++ b/src/filereader.c @@ -68,15 +68,15 @@ char *read_file(char const * const filename) { char buf[STD_FILE_BUF], *string = NULL; - int objfile = 0; + int fd = 0; size_t str_size = 0; ssize_t n; - objfile = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY); - if (objfile != -1) { + if (fd != -1) { /* read and copy chunks */ - while ((n = read(objfile, buf, STD_FILE_BUF)) > 0) { + while ((n = read(fd, buf, STD_FILE_BUF)) > 0) { char *tmp_ptr = NULL; str_size += n; /* count total bytes read */ @@ -94,7 +94,7 @@ char *read_file(char const * const filename) /* add trailing NULL byte */ string[str_size] = '\0'; - close(objfile); + close(fd); return string; } else {