]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: export userns_mkdir() + userns_lchown() so that it can be used elsewhere...
authorLennart Poettering <lennart@poettering.net>
Wed, 5 May 2021 10:29:01 +0000 (12:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 19 May 2021 15:33:25 +0000 (17:33 +0200)
src/nspawn/meson.build
src/nspawn/nspawn.c
src/nspawn/nspawn.h [new file with mode: 0644]

index 172ded43c116ffe7f75052eca86e9225e063968a..a0e051ed3290454f69ed90b49b9d066b9b1493df 100644 (file)
@@ -26,6 +26,7 @@ libnspawn_core_sources = files('''
         nspawn-setuid.h
         nspawn-stub-pid1.c
         nspawn-stub-pid1.h
+        nspawn.h
 '''.split())
 
 nspawn_gperf_c = custom_target(
index a8441bf8e0031326fe955692077f1c6420eef349..9dbe2af5d90ae295bd824b929087618a43ed65ee 100644 (file)
@@ -76,6 +76,7 @@
 #include "nspawn-settings.h"
 #include "nspawn-setuid.h"
 #include "nspawn-stub-pid1.h"
+#include "nspawn.h"
 #include "nulstr-util.h"
 #include "os-util.h"
 #include "pager.h"
@@ -1818,7 +1819,7 @@ static int verify_arguments(void) {
         return 0;
 }
 
-static int userns_lchown(const char *p, uid_t uid, gid_t gid) {
+int userns_lchown(const char *p, uid_t uid, gid_t gid) {
         assert(p);
 
         if (arg_userns_mode == USER_NAMESPACE_NO)
@@ -1847,7 +1848,7 @@ static int userns_lchown(const char *p, uid_t uid, gid_t gid) {
         return 0;
 }
 
-static int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid_t gid) {
+int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid_t gid) {
         const char *q;
         int r;
 
diff --git a/src/nspawn/nspawn.h b/src/nspawn/nspawn.h
new file mode 100644 (file)
index 0000000..27fb0b4
--- /dev/null
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include <sys/types.h>
+
+int userns_lchown(const char *p, uid_t uid, gid_t gid);
+int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid_t gid);