View | Details | Raw Unified | Return to ticket 1036
Collapse All | Expand All

(-)a/src/common/env.c (+23 lines)
Lines 1604-1609 void env_array_merge(char ***dest_array, const char **src_array) Link Here
1604
}
1604
}
1605
1605
1606
/*
1606
/*
1607
 * Merge the environment variables in src_array beginning with "SLURM" into the
1608
 * array dest_array.  Any variables already found in dest_array will be
1609
 * overwritten with the value from src_array.
1610
 */
1611
void env_array_merge_slurm(char ***dest_array, const char **src_array)
1612
{
1613
	char **ptr;
1614
	char name[256], *value;
1615
1616
	if (src_array == NULL)
1617
		return;
1618
1619
	value = xmalloc(ENV_BUFSIZE);
1620
	for (ptr = (char **)src_array; *ptr != NULL; ptr++) {
1621
		if (_env_array_entry_splitter(*ptr, name, sizeof(name),
1622
					      value, ENV_BUFSIZE) &&
1623
		    (strncmp(name, "SLURM", 5) == 0))
1624
			env_array_overwrite(dest_array, name, value);
1625
	}
1626
	xfree(value);
1627
}
1628
1629
/*
1607
 * Strip out trailing carriage returns and newlines
1630
 * Strip out trailing carriage returns and newlines
1608
 */
1631
 */
1609
static void _strip_cr_nl(char *line)
1632
static void _strip_cr_nl(char *line)
(-)a/src/common/env.h (+7 lines)
Lines 195-200 void env_unset_environment(void); Link Here
195
void env_array_merge(char ***dest_array, const char **src_array);
195
void env_array_merge(char ***dest_array, const char **src_array);
196
196
197
/*
197
/*
198
 * Merge the environment variables in src_array beginning with "SLURM" into the
199
 * array dest_array.  Any variables already found in dest_array will be
200
 * overwritten with the value from src_array.
201
 */
202
void env_array_merge_slurm(char ***dest_array, const char **src_array);
203
204
/*
198
 * Copy env_array must be freed by env_array_free
205
 * Copy env_array must be freed by env_array_free
199
 */
206
 */
200
char **env_array_copy(const char **array);
207
char **env_array_copy(const char **array);
(-)a/src/sbatch/sbatch.c (+2 lines)
Lines 465-470 static int _fill_job_desc_from_opts(job_desc_msg_t *desc) Link Here
465
		env_array_merge(&desc->environment, (const char **)environ);
465
		env_array_merge(&desc->environment, (const char **)environ);
466
	} else if (!strcasecmp(opt.export_env, "NONE")) {
466
	} else if (!strcasecmp(opt.export_env, "NONE")) {
467
		desc->environment = env_array_create();
467
		desc->environment = env_array_create();
468
		env_array_merge_slurm(&desc->environment,
469
				      (const char **)environ);
468
		opt.get_user_env_time = 0;
470
		opt.get_user_env_time = 0;
469
	} else {
471
	} else {
470
		_env_merge_filter(desc);
472
		_env_merge_filter(desc);

Return to ticket 1036