Changeset 5689
- Timestamp:
- 11/04/09 15:22:43 (3 weeks ago)
- Files:
-
- 1 modified
-
mpich2/trunk/src/pm/smpd/smpd_command.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mpich2/trunk/src/pm/smpd/smpd_command.c
r4502 r5689 556 556 int smpd_add_command_arg(smpd_command_t *cmd_ptr, char *param, char *value) 557 557 { 558 char *str ;559 int len ;558 char *str=NULL, *tmp_value=NULL; 559 int len, value_len; 560 560 int result; 561 561 int cmd_length; … … 591 591 } 592 592 593 /* Check if we have a escape character at the end of the 594 * value string 595 * If we do, add a separator character to value string 596 */ 597 value_len = (int )strlen(value); 598 tmp_value = NULL; 599 if(value[value_len - 1] == MPIU_STR_ESCAPE_CHAR){ 600 tmp_value = (char *)MPIU_Malloc(value_len + 2); 601 if(tmp_value == NULL){ 602 smpd_err_printf("Unable to allocate memory for tmp value string\n"); 603 smpd_exit_fn(FCNAME); 604 return SMPD_FAIL; 605 } 606 MPIU_Strncpy(tmp_value, value, value_len + 2); 607 tmp_value[value_len] = MPIU_STR_SEPAR_CHAR; 608 tmp_value[value_len + 1] = '\0'; 609 value = tmp_value; 610 } 611 593 612 result = MPIU_Str_add_string_arg(&str, &len, param, value); 594 613 if (result != MPIU_STR_SUCCESS) 595 614 { 596 smpd_err_printf("unable to add the command parameter: %s=%s\n", param, value); 597 smpd_exit_fn(FCNAME); 598 return SMPD_FAIL; 599 } 615 smpd_err_printf("unable to add the command parameter: %s=%s\n", param, value); 616 if(tmp_value) MPIU_Free(tmp_value); 617 smpd_exit_fn(FCNAME); 618 return SMPD_FAIL; 619 } 620 621 if(tmp_value) MPIU_Free(tmp_value); 600 622 smpd_exit_fn(FCNAME); 601 623 return SMPD_SUCCESS;
