aboutsummaryrefslogtreecommitdiff
path: root/os-posix.c
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2023-09-01 13:12:57 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2023-09-01 23:46:20 +0200
commit5b15639003a267b8254ae597a0b8bfefe36ced7b (patch)
tree9102d2501b46bff87e6dd52d4bc44bdbd6a4cb4f /os-posix.c
parent22d0251570d505681d7bba6a00bcae08f962189d (diff)
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>
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/os-posix.c b/os-posix.c
index f0ee5c8b00..ed0787ecfd 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -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;
@@ -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;
}
@@ -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) {