Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
os-posix.c: create and export os_set_chroot()
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-ID: <20230901101302.3618955-4-mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Michael Tokarev authored and bonzini committed Sep 1, 2023
1 parent 22d0251 commit 5b15639
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/sysemu/os-posix.h
Expand Up @@ -51,6 +51,7 @@ int os_set_daemonize(bool d);
bool is_daemonized(void);
void os_daemonize(void);
bool os_set_runas(const char *optarg);
void os_set_chroot(const char *optarg);
void os_setup_post(void);
int os_mlock(void);

Expand Down
9 changes: 7 additions & 2 deletions os-posix.c
Expand Up @@ -159,7 +159,7 @@ int os_parse_cmd_args(int index, const char *optarg)
break;
case QEMU_OPTION_chroot:
warn_report("option is deprecated, use '-run-with chroot=...' instead");
chroot_dir = optarg;
os_set_chroot(optarg);
break;
case QEMU_OPTION_daemonize:
daemonize = 1;
Expand All @@ -184,7 +184,7 @@ int os_parse_cmd_args(int index, const char *optarg)
#endif
str = qemu_opt_get(opts, "chroot");
if (str) {
chroot_dir = str;
os_set_chroot(str);
}
break;
}
Expand Down Expand Up @@ -232,6 +232,11 @@ static void change_process_uid(void)
}
}

void os_set_chroot(const char *optarg)
{
chroot_dir = optarg;
}

static void change_root(void)
{
if (chroot_dir) {
Expand Down

0 comments on commit 5b15639

Please sign in to comment.