chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journal: move type_to_context() to journal-file.c
[elogind.git]
/
src
/
shared
/
path-lookup.c
diff --git
a/src/shared/path-lookup.c
b/src/shared/path-lookup.c
index 7a715b713375cb23aa8798762c266e535c6e1e49..8f75a8e83290db85540d544d82af45c4343e2852 100644
(file)
--- a/
src/shared/path-lookup.c
+++ b/
src/shared/path-lookup.c
@@
-61,6
+61,23
@@
int user_config_home(char **config_home) {
return 0;
}
return 0;
}
+int user_runtime_dir(char **runtime_dir) {
+ const char *e;
+ char *r;
+
+ e = getenv("XDG_RUNTIME_DIR");
+ if (e) {
+ r = strappend(e, "/systemd/user");
+ if (!r)
+ return -ENOMEM;
+
+ *runtime_dir = r;
+ return 1;
+ }
+
+ return 0;
+}
+
static char** user_dirs(
const char *generator,
const char *generator_early,
static char** user_dirs(
const char *generator,
const char *generator_early,
@@
-69,10
+86,11
@@
static char** user_dirs(
const char * const config_unit_paths[] = {
USER_CONFIG_UNIT_PATH,
"/etc/systemd/user",
const char * const config_unit_paths[] = {
USER_CONFIG_UNIT_PATH,
"/etc/systemd/user",
- "/run/systemd/user",
NULL
};
NULL
};
+ const char * const runtime_unit_path = "/run/systemd/user";
+
const char * const data_unit_paths[] = {
"/usr/local/lib/systemd/user",
"/usr/local/share/systemd/user",
const char * const data_unit_paths[] = {
"/usr/local/lib/systemd/user",
"/usr/local/share/systemd/user",
@@
-83,7
+101,7
@@
static char** user_dirs(
};
const char *home, *e;
};
const char *home, *e;
- _cleanup_free_ char *config_home = NULL, *data_home = NULL;
+ _cleanup_free_ char *config_home = NULL, *
runtime_dir = NULL, *
data_home = NULL;
_cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
char **r = NULL;
_cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
char **r = NULL;
@@
-99,6
+117,9
@@
static char** user_dirs(
if (user_config_home(&config_home) < 0)
goto fail;
if (user_config_home(&config_home) < 0)
goto fail;
+ if (user_runtime_dir(&runtime_dir) < 0)
+ goto fail;
+
home = getenv("HOME");
e = getenv("XDG_CONFIG_DIRS");
home = getenv("HOME");
e = getenv("XDG_CONFIG_DIRS");
@@
-148,6
+169,13
@@
static char** user_dirs(
if (strv_extend_strv(&r, (char**) config_unit_paths) < 0)
goto fail;
if (strv_extend_strv(&r, (char**) config_unit_paths) < 0)
goto fail;
+ if (runtime_dir)
+ if (strv_extend(&r, runtime_dir) < 0)
+ goto fail;
+
+ if (strv_extend(&r, runtime_unit_path) < 0)
+ goto fail;
+
if (generator)
if (strv_extend(&r, generator) < 0)
goto fail;
if (generator)
if (strv_extend(&r, generator) < 0)
goto fail;
@@
-212,7
+240,7
@@
int lookup_paths_init(
if (!p->unit_path || append) {
/* Let's figure something out. */
if (!p->unit_path || append) {
/* Let's figure something out. */
- char **unit_path;
+
_cleanup_strv_free_
char **unit_path;
int r;
/* For the user units we include share/ in the search
int r;
/* For the user units we include share/ in the search