check status of ftruncate() in ave/* fixes

This commit is contained in:
Axel Kohlmeyer
2019-10-19 10:49:05 -04:00
parent f4fcd2a911
commit bf537dedf5
6 changed files with 12 additions and 6 deletions

View File

@ -504,7 +504,8 @@ void FixAveCorrelateLong::end_of_step()
fflush(fp); fflush(fp);
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }

View File

@ -1055,7 +1055,8 @@ void FixAveChunk::end_of_step()
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }
} }

View File

@ -535,7 +535,8 @@ void FixAveCorrelate::end_of_step()
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }

View File

@ -851,7 +851,8 @@ void FixAveHisto::end_of_step()
fflush(fp); fflush(fp);
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }
} }

View File

@ -493,7 +493,8 @@ void FixAveHistoWeight::end_of_step()
fflush(fp); fflush(fp);
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }
} }

View File

@ -698,7 +698,8 @@ void FixAveTime::invoke_scalar(bigint ntimestep)
if (overwrite) { if (overwrite) {
long fileend = ftell(fp); long fileend = ftell(fp);
if (fileend > 0) ftruncate(fileno(fp),fileend); if ((fileend > 0) && (ftruncate(fileno(fp),fileend)))
perror("Error while tuncating output");
} }
} }
} }