Merge pull request #600 from swick/wip/get-newroot-path

utils: Move get_newroot_path to utils
This commit is contained in:
Simon McVittie
2023-10-01 13:01:38 +01:00
committed by GitHub
3 changed files with 9 additions and 8 deletions

View File

@@ -946,14 +946,6 @@ drop_privs (bool keep_requested_caps,
die_with_error ("can't set dumpable"); die_with_error ("can't set dumpable");
} }
static char *
get_newroot_path (const char *path)
{
while (*path == '/')
path++;
return strconcat ("/newroot/", path);
}
static void static void
write_uid_gid_map (uid_t sandbox_uid, write_uid_gid_map (uid_t sandbox_uid,
uid_t parent_uid, uid_t parent_uid,

View File

@@ -823,6 +823,14 @@ get_oldroot_path (const char *path)
return strconcat ("/oldroot/", path); return strconcat ("/oldroot/", path);
} }
char *
get_newroot_path (const char *path)
{
while (*path == '/')
path++;
return strconcat ("/newroot/", path);
}
int int
raw_clone (unsigned long flags, raw_clone (unsigned long flags,
void *child_stack) void *child_stack)

View File

@@ -121,6 +121,7 @@ void create_pid_socketpair (int sockets[2]);
void send_pid_on_socket (int socket); void send_pid_on_socket (int socket);
int read_pid_from_socket (int socket); int read_pid_from_socket (int socket);
char *get_oldroot_path (const char *path); char *get_oldroot_path (const char *path);
char *get_newroot_path (const char *path);
char *readlink_malloc (const char *pathname); char *readlink_malloc (const char *pathname);
/* syscall wrappers */ /* syscall wrappers */