Merge pull request #24071 from bluca/path_trigger_report

path/timer units: export env vars and D-Bus properties with reason that triggered the job
This commit is contained in:
Lennart Poettering
2022-08-24 09:35:59 +02:00
committed by GitHub
34 changed files with 728 additions and 59 deletions
+13 -2
View File
@@ -47,17 +47,28 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
return 0;
}
int glob_exists(const char *path) {
int glob_first(const char *path, char **ret_first) {
_cleanup_globfree_ glob_t g = {};
int k;
assert(path);
k = safe_glob(path, GLOB_NOSORT|GLOB_BRACE, &g);
if (k == -ENOENT)
if (k == -ENOENT) {
if (ret_first)
*ret_first = NULL;
return false;
}
if (k < 0)
return k;
if (ret_first) {
char *first = strdup(g.gl_pathv[0]);
if (!first)
return log_oom_debug();
*ret_first = first;
}
return true;
}
+3 -1
View File
@@ -10,7 +10,9 @@
/* Note: this function modifies pglob to set various functions. */
int safe_glob(const char *path, int flags, glob_t *pglob);
int glob_exists(const char *path);
/* Note: which match is returned depends on the implementation/system and not guaranteed to be stable */
int glob_first(const char *path, char **ret_first);
#define glob_exists(path) glob_first(path, NULL)
int glob_extend(char ***strv, const char *path, int flags);
int glob_non_glob_prefix(const char *path, char **ret);