Commit 82682417 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed size of command to CMOR_MAX_STRING.

parent 557ae2f9
......@@ -5391,7 +5391,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
}
if ( ifreq == 7 )
{
char smon1[3], smon2[3];
char smon1[12], smon2[12];
strncpy(smon1, &timename[5], 2);
strncpy(smon2, &timename[12], 2);
smon1[2] = '\0';
......@@ -5400,7 +5400,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
sprintf(smon1, "%02d", atoi(smon1)-1);
else
{
char syr[5];
char syr[12];
strncpy(syr, &timename[1], 4);
syr[4] = '\0';
sprintf(syr, "%04d", atoi(syr)-1);
......@@ -5412,7 +5412,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
sprintf(smon2, "%02d", atoi(smon2)+1);
else
{
char syr[5];
char syr[12];
strncpy(syr, &timename[8], 4);
syr[4] = '\0';
sprintf(syr, "%04d", atoi(syr)-1);
......@@ -5424,7 +5424,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
strncpy(&timename[12], smon2, 2);
}
char command[CDI_MAX_NAME];
char command[CMOR_MAX_STRING];
sprintf(command, "mkdir -p %s/%s", kv_get_a_val(kvl, "cordexDir", nullptr), varname);
int dir_err = system(command);
......@@ -5450,7 +5450,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
cdoPrint(" File stored in: '%s' with cmor!", cordex_file_name);
}
}
else
else
{
char *realization = kv_get_a_val(kvl, "realization", nullptr);
if ( !realization )
......@@ -5458,7 +5458,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if ( realization[0] == '0' && realization[1] )
{
char newname[CDI_MAX_NAME], oldmember[CDI_MAX_NAME],
char newname[CDI_MAX_NAME], oldmember[CDI_MAX_NAME],
newmember[CDI_MAX_NAME], chunkpath[CDI_MAX_NAME], oldchunkpath[CDI_MAX_NAME];
sprintf(oldmember, "r%ldi", atol(realization));
sprintf(newmember, "r%si", realization);
......@@ -5476,7 +5476,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if ( !oldchunkcopied )
chunkpath[startpattern] = '\0';
else
chunkpath[startpattern+strlen(newmember)-patternlength] = '\0';
chunkpath[startpattern+strlen(newmember)-patternlength] = '\0';
startcmp += patternlength;
startpattern += patternlength;
sprintf(newname, "%s%s%s", chunkpath, newmember, startcmp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment