1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

nspawn: export userns_mkdir() + userns_lchown() so that it can be used elsewhere in nspawn

This commit is contained in:
Lennart Poettering 2021-05-05 12:29:01 +02:00
parent 1a298a206c
commit 91181e075b
3 changed files with 11 additions and 2 deletions

View 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(

View 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;

7
src/nspawn/nspawn.h Normal file
View File

@ -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);