diff --git a/usr.sbin/bhyve/slirp/slirp-helper.c b/usr.sbin/bhyve/slirp/slirp-helper.c index ee62dd21236..06f393aab72 100644 --- a/usr.sbin/bhyve/slirp/slirp-helper.c +++ b/usr.sbin/bhyve/slirp/slirp-helper.c @@ -547,6 +547,11 @@ main(int argc, char **argv) priv.slirp = slirp; + /* + * Drop root privileges if we have them. + */ + drop_privs(); + /* * In restricted mode, we can enter a Capsicum sandbox without losing * functionality. @@ -554,11 +559,6 @@ main(int argc, char **argv) if (restricted && caph_enter() != 0) err(1, "caph_enter"); - /* - * Drop root privileges if we have them. - */ - drop_privs(); - /* * Enter our main loop. If bhyve goes away, we should observe a hangup * on the socket and exit.