1
1

Fix silly string error (missing +2 in the len calculation, so just

replace it with asprintf).  Reviewed by Brian.

This commit was SVN r5700.
Этот коммит содержится в:
Jeff Squyres 2005-05-12 18:56:05 +00:00
родитель f96d763aa7
Коммит 544f9dd780

Просмотреть файл

@ -94,7 +94,7 @@ int mca_base_cmd_line_process_args(ompi_cmd_line_t *cmd)
*/ */
int mca_base_cmd_line_process_arg(const char *param, const char *value) int mca_base_cmd_line_process_arg(const char *param, const char *value)
{ {
int i, len; int i;
char *new_str; char *new_str;
/* Look to see if we've already got an -mca argument for the same /* Look to see if we've already got an -mca argument for the same
@ -103,9 +103,7 @@ int mca_base_cmd_line_process_arg(const char *param, const char *value)
for (i = 0; NULL != mca_param_argv && NULL != mca_param_argv[i]; ++i) { for (i = 0; NULL != mca_param_argv && NULL != mca_param_argv[i]; ++i) {
if (0 == strcmp(param, mca_param_argv[i])) { if (0 == strcmp(param, mca_param_argv[i])) {
len = strlen(value) + strlen(mca_param_argv[i]); asprintf(&new_str, "%s,%s", mca_value_argv[i], value);
new_str = malloc(len);
snprintf(new_str, len, "%s,%s", mca_value_argv[i], value);
free(mca_value_argv[i]); free(mca_value_argv[i]);
mca_value_argv[i] = new_str; mca_value_argv[i] = new_str;