bugfix: close file before returning
This commit is contained in:
parent
78b6b3ecdb
commit
78bf8b0ab7
|
@ -130,7 +130,10 @@ function IO_read(fileName) result(fileContent)
|
||||||
status='old', position='rewind', action='read',iostat=myStat)
|
status='old', position='rewind', action='read',iostat=myStat)
|
||||||
if(myStat /= 0) call IO_error(100,ext_msg=trim(fileName))
|
if(myStat /= 0) call IO_error(100,ext_msg=trim(fileName))
|
||||||
allocate(character(len=fileLength)::fileContent)
|
allocate(character(len=fileLength)::fileContent)
|
||||||
if(fileLength==0) return
|
if(fileLength==0) then
|
||||||
|
close(fileUnit)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
read(fileUnit,iostat=myStat) fileContent
|
read(fileUnit,iostat=myStat) fileContent
|
||||||
if(myStat /= 0) call IO_error(102,ext_msg=trim(fileName))
|
if(myStat /= 0) call IO_error(102,ext_msg=trim(fileName))
|
||||||
|
|
Loading…
Reference in New Issue