extern struct ul_env_list *env_list_add_variable(struct ul_env_list *ls,
const char *name, const char *value);
-
-
extern int env_list_setenv(struct ul_env_list *ls, int overwrite);
extern void env_list_free(struct ul_env_list *ls);
-extern struct ul_env_list *env_from_fd(int pid);
+extern struct ul_env_list *env_list_from_fd(int pid);
extern char *safe_getenv(const char *arg);
err(XSETENV_EXIT_CODE, _("failed to set the %s environment variable"), name);
}
-static inline int remove_entry(char **argv, int remove, int last)
+static inline int ul_remove_entry(char **argv, int remove, int last)
{
memmove(argv + remove, argv + remove + 1, sizeof(char *) * (last - remove));
return last - 1;
}
/*
- * Use env_from_fd() to read environment from @fd.
+ * Use env_list_from_fd() to read environment from @fd.
*
* @fd must be /proc/<pid>/environ file.
*/
-struct ul_env_list *env_from_fd(int fd)
+struct ul_env_list *env_list_from_fd(int fd)
{
char *buf = NULL, *p;
ssize_t rc = 0;
if (strncmp(*cur, *bad, strlen(*bad)) == 0) {
if (org)
*org = env_list_add_from_string(*org, *cur);
- last = remove_entry(envp, cur - envp, last);
+ last = ul_remove_entry(envp, cur - envp, last);
cur--;
break;
}
continue; /* OK */
if (org)
*org = env_list_add_from_string(*org, *cur);
- last = remove_entry(envp, cur - envp, last);
+ last = ul_remove_entry(envp, cur - envp, last);
cur--;
break;
}
/* Pass environment variables of the target process to the spawned process */
if (env_fd >= 0) {
- if ((envls = env_from_fd(env_fd)) == NULL)
+ if ((envls = env_list_from_fd(env_fd)) == NULL)
err(EXIT_FAILURE, _("failed to get environment variables"));
clearenv();
if (env_list_setenv(envls, 0) < 0)
}
}
if (move) {
- as_argc = remove_entry(as_argv, opt, as_argc);
+ as_argc = ul_remove_entry(as_argv, opt, as_argc);
opt--;
}
}