diff options
-rw-r--r-- | src/Startup.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/Startup.c b/src/Startup.c index 618a106..3e29dcc 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -705,6 +705,7 @@ static int CopyParFile (int recovered) { int in_parfile, out_parfile, bytes, flags; char *out_parfilename, buffer[256]; + const char *my_parfile_name; struct stat in_stat_buf, out_stat_buf; DECLARE_CCTK_PARAMETERS @@ -726,21 +727,22 @@ static int CopyParFile (int recovered) } /* build the name of the output parfile */ - if (! *parfile_name) + my_parfile_name = parfile_name; + if (! *my_parfile_name) { /* cut off any path names */ - parfile_name = strrchr (buffer, '/'); - if (parfile_name) + my_parfile_name = strrchr (buffer, '/'); + if (my_parfile_name) { - parfile_name++; + my_parfile_name++; } else { - parfile_name = buffer; + my_parfile_name = buffer; } } - out_parfilename = (char *) malloc (strlen(out_dir) + strlen(parfile_name)+2); - sprintf (out_parfilename, "%s/%s", out_dir, parfile_name); + out_parfilename = malloc (strlen (out_dir) + strlen (my_parfile_name) + 2); + sprintf (out_parfilename, "%s/%s", out_dir, my_parfile_name); /* check whether input and output files are identical */ if (! stat (out_parfilename, &out_stat_buf) && @@ -749,7 +751,7 @@ static int CopyParFile (int recovered) CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Parameter file '%s' to be written into directory '%s' is " "identical with original parameter file. Parameter file will " - "not be copied.", parfile_name, out_dir); + "not be copied.", my_parfile_name, out_dir); out_parfile = 0; } else @@ -818,6 +820,7 @@ static int GenerateParFile (int recovered) FILE *outfile; int out_parfile, flags; char *out_parfilename, buffer[256]; + const char *my_parfile_name; struct stat in_stat_buf, out_stat_buf; DECLARE_CCTK_PARAMETERS @@ -833,21 +836,22 @@ static int GenerateParFile (int recovered) } /* build the name of the output parfile */ - if (! *parfile_name) + my_parfile_name = parfile_name; + if (! *my_parfile_name) { /* cut off any path names */ - parfile_name = strrchr (buffer, '/'); - if (parfile_name) + my_parfile_name = strrchr (buffer, '/'); + if (my_parfile_name) { - parfile_name++; + my_parfile_name++; } else { - parfile_name = buffer; + my_parfile_name = buffer; } } - out_parfilename = (char *) malloc (strlen(out_dir) + strlen(parfile_name)+2); - sprintf (out_parfilename, "%s/%s", out_dir, parfile_name); + out_parfilename = malloc (strlen (out_dir) + strlen (my_parfile_name) + 2); + sprintf (out_parfilename, "%s/%s", out_dir, my_parfile_name); /* check whether input and output files are identical */ if (! stat (out_parfilename, &out_stat_buf) && @@ -856,7 +860,7 @@ static int GenerateParFile (int recovered) CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Parameter file '%s' to be written into directory '%s' is " "identical with original parameter file. Parameter file will " - "not be generated.", parfile_name, out_dir); + "not be generated.", my_parfile_name, out_dir); out_parfile = 0; } else |