]> git.proxmox.com Git - mirror_qemu.git/commitdiff
os-posix.c: create and export os_set_chroot()
authorMichael Tokarev <mjt@tls.msk.ru>
Fri, 1 Sep 2023 10:12:57 +0000 (13:12 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 1 Sep 2023 21:46:20 +0000 (23:46 +0200)
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>
include/sysemu/os-posix.h
os-posix.c

index d32630f9e766398601b1a1340686a6d162b90e2a..8a667633953b1b66444cf6d25840e5341da3156a 100644 (file)
@@ -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);
 
index f0ee5c8b0020489f2e2eec41ba9ae8a924632d58..ed0787ecfd9dd7f635c4e819f545fc22b5848121 100644 (file)
@@ -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) {