MCPcopy Create free account
hub / github.com/F-Stack/f-stack / setenv_static

Function setenv_static

freebsd/kern/kern_environment.c:525–543  ·  view source on GitHub ↗

* Set an environment variable in the MD-static environment. This cannot * feasibly be done on config(8)-generated static environments as they don't * generally include space for extra variables. */

Source from the content-addressed store, hash-verified

523 * generally include space for extra variables.
524 */
525static int
526setenv_static(const char *name, const char *value)
527{
528 int len;
529
530 if (md_env_pos >= md_env_len)
531 return (-1);
532
533 /* Check space for x=y and two nuls */
534 len = strlen(name) + strlen(value);
535 if (len + 3 < md_env_len - md_env_pos) {
536 len = sprintf(&md_envp[md_env_pos], "%s=%s", name, value);
537 md_env_pos += len+1;
538 md_envp[md_env_pos] = '\0';
539 return (0);
540 } else
541 return (-1);
542
543}
544
545/*
546 * Set an environment variable by name.

Callers 1

kern_setenvFunction · 0.85

Calls 1

sprintfFunction · 0.85

Tested by

no test coverage detected