]> skyeroc.xyz Git - dgamelaunch/commitdiff
ACTUALLY try to use the dglroot dir as home if we are doing the chroot
authorTangles <andyrthomson@gmail.com>
Sat, 22 Feb 2020 01:48:31 +0000 (12:48 +1100)
committerTangles <andyrthomson@gmail.com>
Sat, 22 Feb 2020 01:48:31 +0000 (12:48 +1100)
...and fallback to / if it FAILS (not if it succeeds) *facepalm*

dgamelaunch.c

index 80178f6190238bcd9d1e8a1d9e61f18c40abad41..48b4806e77b34ec7a104fb4f95f8429f22dbac58 100644 (file)
@@ -3126,12 +3126,12 @@ main (int argc, char** argv)
       if (chdir (globalconfig.dglroot))
         {
           perror("warning: cannot chdir to dglroot directory, using / instead");
+          if (chdir ("/"))
+           {
+             perror ("cannot chdir to root directory");
+             graceful_exit (3);
+           }
         }
-      else if (chdir ("/"))
-       {
-         perror ("cannot chdir to root directory");
-         graceful_exit (3);
-       }
 
       /* shed privs. this is done immediately after chroot. */
       if (setgroups (1, &globalconfig.shed_gid) == -1)