#include "nulstr-util.h"
#include "parse-util.h"
#include "path-util.h"
+#include "portable-util.h"
#include "pretty-print.h"
#include "seccomp-util.h"
#include "service.h"
return TAKE_PTR(paths);
}
-
-int find_portable_profile(const char *name, const char *unit, char **ret_path) {
- const char *dot;
- int r;
-
- assert(name);
- assert(ret_path);
-
- assert_se(dot = strrchr(unit, '.'));
-
- NULSTR_FOREACH(p, PORTABLE_PROFILE_DIRS) {
- _cleanup_free_ char *joined = NULL;
-
- joined = strjoin(p, "/", name, "/", dot + 1, ".conf");
- if (!joined)
- return -ENOMEM;
-
- r = access_nofollow(joined, F_OK);
- if (r >= 0) {
- *ret_path = TAKE_PTR(joined);
- return 0;
- }
- if (r != -ENOENT)
- return r;
- }
-
- return -ENOENT;
-}
#include <stdbool.h>
-#include "constants.h"
-#include "macro.h"
#include "runtime-scope.h"
typedef enum LookupPathsFlags {
char **generator_binary_paths(RuntimeScope scope);
char **env_generator_binary_paths(RuntimeScope scope);
-
-#define PORTABLE_PROFILE_DIRS CONF_PATHS_NULSTR("systemd/portable/profile")
-int find_portable_profile(const char *name, const char *unit, char **ret_path);
#include "os-util.h"
#include "path-lookup.h"
#include "portable.h"
+#include "portable-util.h"
#include "process-util.h"
#include "rm-rf.h"
#include "selinux-util.h"
'pkcs11-util.c',
'plymouth-util.c',
'polkit-agent.c',
+ 'portable-util.c',
'pretty-print.c',
'capsule-util.c',
'ptyfwd.c',
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "fs-util.h"
+#include "nulstr-util.h"
+#include "portable-util.h"
+#include "string-util.h"
+
+int find_portable_profile(const char *name, const char *unit, char **ret_path) {
+ const char *dot;
+ int r;
+
+ assert(name);
+ assert(ret_path);
+
+ assert_se(dot = strrchr(unit, '.'));
+
+ NULSTR_FOREACH(p, PORTABLE_PROFILE_DIRS) {
+ _cleanup_free_ char *joined = NULL;
+
+ joined = strjoin(p, "/", name, "/", dot + 1, ".conf");
+ if (!joined)
+ return -ENOMEM;
+
+ r = access_nofollow(joined, F_OK);
+ if (r >= 0) {
+ *ret_path = TAKE_PTR(joined);
+ return 0;
+ }
+ if (r != -ENOENT)
+ return r;
+ }
+
+ return -ENOENT;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "constants.h"
+#include "macro.h"
+
+#define PORTABLE_PROFILE_DIRS CONF_PATHS_NULSTR("systemd/portable/profile")
+
+int find_portable_profile(const char *name, const char *unit, char **ret_path);