aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverGH.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2004-06-30 14:16:34 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2004-06-30 14:16:34 +0000
commiteb3621c118d57c485c23d63bfdb005d05bb73e11 (patch)
treebadbfac39853738d38a0bc0f8f54e307fcdbff33 /src/RecoverGH.c
parent50c54f5cd9648dc48090748e2859d6d76db19872 (diff)
Use the new routine IOUtil_AssembleFilename() to generate filenames for
checkpoint/filereader files. This closes PR CactusPUGHIO 1061: "IOHDF5/DumpGH.c/Checkpoint writes to strings without checking the string lengths". git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@327 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/RecoverGH.c')
-rw-r--r--src/RecoverGH.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index c2de6c1..be1a3a4 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -117,6 +117,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
called_from == FILEREADER_DATA ||
(GH && (GH->cctk_levfac[0] > 1 || GH->cctk_convlevel > 0)))
{
+ memset (&file, 0, sizeof (file));
if (OpenFile (GH, basefilename, called_from, &file) < 0)
{
return (-1);
@@ -282,9 +283,9 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
we need to try both file names. */
/* at first try with unchunked mode */
file->unchunked = 1;
- IOUtil_PrepareFilename (GH, basefilename, file->filename, called_from, 0,
- file->unchunked);
- strcat (file->filename, ".ieee");
+ free (file->filename);
+ file->filename = IOUtil_AssembleFilename (GH, basefilename, "", ".ieee",
+ called_from, 0, file->unchunked);
if (myproc == 0)
{
@@ -303,9 +304,9 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
/* now try with chunked mode */
file->unchunked = 0;
- IOUtil_PrepareFilename (GH, basefilename, file->filename, called_from, 0,
- file->unchunked);
- strcat (file->filename, ".ieee");
+ free (file->filename);
+ file->filename = IOUtil_AssembleFilename (GH, basefilename, "", ".ieee",
+ called_from, 0,file->unchunked);
if (CCTK_Equals (verbose, "full"))
{
@@ -439,9 +440,11 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
/* Determine the IO processors for each node and the corresponding
checkpoint file */
file->ioproc = myproc - (myproc % file->ioproc_every);
- IOUtil_PrepareFilename (GH, basefilename, file->filename, called_from,
- file->ioproc/file->ioproc_every, file->unchunked);
- strcat (file->filename, ".ieee");
+ free (file->filename);
+ file->filename = IOUtil_AssembleFilename (GH, basefilename, "", ".ieee",
+ called_from,
+ file->ioproc / file->ioproc_every,
+ file->unchunked);
/* Open chunked files on other IO processors */
if (myproc == file->ioproc && myproc != 0)