Skip to content
Snippets Groups Projects
Commit 61d8c988 authored by KyleKlenk's avatar KyleKlenk
Browse files

fixed issue with buffer overflow and added 3 attempts to create a file

parent 73dcc5df
No related branches found
No related tags found
No related merge requests found
......@@ -14,16 +14,16 @@ ACTORS_LIBRARIES = -L/usr/local/lib -L$(ROOT_DIR)/bin -lcaf_core -lcaf_io -lsumm
# Production runs
# FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
# FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
# FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
# FLAGS_ACTORS = -O3 -Wfatal-errors -std=c++17
FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
FLAGS_ACTORS = -O3 -Wfatal-errors -std=c++17
# # Debug runs
FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
FLAGS_ACTORS = -g -O0 -Wall -std=c++17
# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
......
......@@ -226,8 +226,13 @@ void initalizeFileAccessActor(stateful_actor<file_access_state>* self) {
initFailedHRUTracker(&self->state.numGRU);
// The CreateOutput Routine Can Fail So we may have to try it multiple times
int attempt = 0;
def_output(self->state.handle_ncid, &self->state.startGRU, &self->state.numGRU, &self->state.numGRU, &err);
int maxAttempt = 3;
for (int i = 0; i < maxAttempt; i++) {
def_output(self->state.handle_ncid, &self->state.startGRU, &self->state.numGRU, &self->state.numGRU, &err);
if (err == 0) {
break;
}
}
if (err != 0) {
aout(self) << "ERROR: Create_OutputFile\n";
std::string function = "Create_Output_File";
......
......@@ -67,7 +67,7 @@ void connecting(stateful_actor<summa_client_state>* self, const std::string& hos
behavior running(stateful_actor<summa_client_state>* self, const actor& server_actor) {
char host[HOST_NAME_MAX];
aout(self) << "Client Has Started Successfully" << std::endl;
gethostname(host, 1024);
gethostname(host, HOST_NAME_MAX);
self->state.hostname = host;
self->send(server_actor, connect_to_server_v, self, self->state.hostname);
......
......@@ -126,15 +126,19 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,err) bind(C, name='def_outp
err=0; message="def_output/"
! allocate space for the output file ID array
allocate(ncid%var(maxVarFreq))
ncid%var(:) = integerMissing
if (.not.allocated(ncid%var))then
allocate(ncid%var(maxVarFreq))
ncid%var(:) = integerMissing
endif
! initalize outputTimeStep - keeps track of the step the GRU is writing for
allocate(outputTimeStep(nGRU))
do iGRU = 1, nGRU
allocate(outputTimeStep(iGRU)%dat(maxVarFreq))
outputTimeStep(iGRU)%dat(:) = 1
end do
if (.not.allocated(outputTimeStep))then
allocate(outputTimeStep(nGRU))
do iGRU = 1, nGRU
allocate(outputTimeStep(iGRU)%dat(maxVarFreq))
outputTimeStep(iGRU)%dat(:) = 1
end do
end if
! Set the global variable for the number of HRU and GRU in run
nGRUrun = nGRU
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment