mirror of
https://github.com/systemd/systemd.git
synced 2025-01-05 13:18:06 +03:00
core/unit: rename set_unit_path() -> setenv_unit_path()
The previous name is quite vague on what this precisely do.
This commit is contained in:
parent
c53a28cea1
commit
6c8ade3066
@ -155,7 +155,7 @@ int verify_set_unit_path(char **filenames) {
|
||||
!strextend_with_separator(&joined, ":", strempty(old)))
|
||||
return -ENOMEM;
|
||||
|
||||
assert_se(set_unit_path(joined) >= 0);
|
||||
assert_se(setenv_unit_path(joined) >= 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3317,9 +3317,11 @@ int unit_add_two_dependencies_by_name(Unit *u, UnitDependency d, UnitDependency
|
||||
return unit_add_two_dependencies(u, d, e, other, add_reference, mask);
|
||||
}
|
||||
|
||||
int set_unit_path(const char *p) {
|
||||
int setenv_unit_path(const char *p) {
|
||||
assert(p);
|
||||
|
||||
/* This is mostly for debug purposes */
|
||||
return RET_NERRNO(setenv("SYSTEMD_UNIT_PATH", p, 1));
|
||||
return RET_NERRNO(setenv("SYSTEMD_UNIT_PATH", p, /* overwrite = */ true));
|
||||
}
|
||||
|
||||
char* unit_dbus_path(Unit *u) {
|
||||
|
@ -880,7 +880,7 @@ void unit_unwatch_bus_name(Unit *u, const char *name);
|
||||
|
||||
bool unit_job_is_applicable(Unit *u, JobType j);
|
||||
|
||||
int set_unit_path(const char *p);
|
||||
int setenv_unit_path(const char *p);
|
||||
|
||||
char* unit_dbus_path(Unit *u);
|
||||
char* unit_dbus_path_invocation_id(Unit *u);
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = bpf_program_new(BPF_PROG_TYPE_CGROUP_SKB, "sd_trivial", &p);
|
||||
|
@ -298,7 +298,7 @@ int main(int argc, char *argv[]) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
ASSERT_OK(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m));
|
||||
|
@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
ASSERT_OK(manager_new(RUNTIME_SCOPE_SYSTEM, MANAGER_TEST_RUN_BASIC, &m));
|
||||
|
@ -40,7 +40,7 @@ TEST_RET(cgroup_mask, .sd_booted = true) {
|
||||
/* Prepare the manager. */
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (IN_SET(r, -EPERM, -EACCES)) {
|
||||
|
@ -24,7 +24,7 @@ TEST_RET(default_memory_low, .sd_booted = true) {
|
||||
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (IN_SET(r, -EPERM, -EACCES)) {
|
||||
|
@ -89,8 +89,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* prepare the test */
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
|
@ -1397,7 +1397,7 @@ static void run_tests(RuntimeScope scope, char **patterns) {
|
||||
ASSERT_NOT_NULL(runtime_dir = setup_fake_runtime_dir());
|
||||
ASSERT_NOT_NULL(user_runtime_unit_dir = path_join(runtime_dir, "systemd/user"));
|
||||
ASSERT_NOT_NULL(unit_paths = strjoin(PRIVATE_UNIT_DIR, ":", user_runtime_unit_dir));
|
||||
ASSERT_OK(set_unit_path(unit_paths));
|
||||
ASSERT_OK(setenv_unit_path(unit_paths));
|
||||
|
||||
r = manager_new(scope, MANAGER_TEST_RUN_BASIC, &m);
|
||||
if (manager_errno_skip_test(r))
|
||||
|
@ -397,8 +397,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
assert_se(get_testdata_dir("test-path", &test_path) >= 0);
|
||||
assert_se(set_unit_path(test_path) >= 0);
|
||||
ASSERT_OK(get_testdata_dir("test-path", &test_path));
|
||||
ASSERT_OK(setenv_unit_path(test_path));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
for (const test_function_t *test = tests; *test; test++) {
|
||||
|
@ -26,8 +26,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* prepare the test */
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);
|
||||
|
@ -126,8 +126,8 @@ int main(int argc, char *argv[]) {
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
assert_se(get_testdata_dir("units", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
ASSERT_OK(get_testdata_dir("units", &unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
assert_se(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0);
|
||||
|
@ -22,8 +22,8 @@ int main(int argc, char *argv[]) {
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
_cleanup_free_ char *unit_dir = NULL;
|
||||
assert_se(get_testdata_dir("units/", &unit_dir) >= 0);
|
||||
assert_se(set_unit_path(unit_dir) >= 0);
|
||||
ASSERT_OK(get_testdata_dir("units/", &unit_dir));
|
||||
ASSERT_OK(setenv_unit_path(unit_dir));
|
||||
|
||||
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user