Fix error handling in read_file()
This commit is contained in:
parent
5b5eea7f03
commit
03fca66adc
@ -67,7 +67,7 @@ char *read_file(char const * const filename)
|
|||||||
|
|
||||||
objfile = open(filename, O_RDONLY);
|
objfile = open(filename, O_RDONLY);
|
||||||
|
|
||||||
if (objfile) {
|
if (objfile != -1) {
|
||||||
/* read and copy chunks */
|
/* read and copy chunks */
|
||||||
while ((n = read(objfile, buf, STD_FILE_BUF)) > 0) {
|
while ((n = read(objfile, buf, STD_FILE_BUF)) > 0) {
|
||||||
char *tmp_ptr = NULL;
|
char *tmp_ptr = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user