Add missing chdir() in the init process

PiperOrigin-RevId: 239425921
Change-Id: Ia1b02ae0a2f319faa601d6098a9f94a3043656a8
diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc
index 1ad8f95..085f0b6 100644
--- a/sandboxed_api/sandbox2/forkserver.cc
+++ b/sandboxed_api/sandbox2/forkserver.cc
@@ -158,6 +158,7 @@
   } else if (child > 0) {
     // Perform some sanitization (basically equals to SanitizeEnvironment
     // except that it does not require /proc to be available).
+    SAPI_RAW_CHECK(chdir("/") == 0, "changing init cwd failed");
     setsid();
     if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0) {
       SAPI_RAW_PLOG(ERROR, "prctl(PR_SET_PDEATHSIG, SIGKILL) failed");