Skip to content

Commit

Permalink
add filename length check
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Aug 5, 2020
1 parent 7a2256c commit 4c91ae3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
return
endif
endif
! check if the length of restartfiles variable is sufficient:
if (len(restartfiles)-len(trim(restartfiles)) < len(trim(restartfile))) then
call MOM_error(FATAL, "Restart file name(s) too long.")
endif
restartfiles = trim(restartfiles) // " " // trim(restartfile)
enddo
close(readunit)
Expand Down Expand Up @@ -1862,7 +1866,7 @@ subroutine ModelAdvance(gcomp, rc)
if (num_rest_files > 1) then
! append i.th restart file name to rpointer
do i=1, num_rest_files-1
if (num_rest_files < 10) then
if (i < 10) then
write(suffix,'("_",I1)') i
else
write(suffix,'("_",I2)') i
Expand Down

0 comments on commit 4c91ae3

Please sign in to comment.