--- src/support/suexec.c	2003-07-04 22:43:55.000000000 +0200
+++ src/support/suexec.c.dist	2003-07-04 17:26:07.000000000 +0200
@@ -502,16 +502,10 @@
 	}
     }
     else {
-	if ((chdir(DOC_ROOT)) != 0) {
-	    log_err("emerg: cannot get docroot information (%s) (1)\n", DOC_ROOT);
-	    exit(113);
-	}
-	if ((getcwd(dwd, AP_MAXPATH)) == NULL) {
-	    log_err("emerg: cannot get docroot information (%s) (2)\n", DOC_ROOT);
-	    exit(113);
-	}
-	if ((chdir(cwd)) != 0) {
-	    log_err("emerg: cannot get docroot information (%s) (cannot change to %s)\n", DOC_ROOT,cwd);
+	if (((chdir(DOC_ROOT)) != 0) ||
+	    ((getcwd(dwd, AP_MAXPATH)) == NULL) ||
+	    ((chdir(cwd)) != 0)) {
+	    log_err("emerg: cannot get docroot information (%s)\n", DOC_ROOT);
 	    exit(113);
 	}
     }
@@ -532,7 +526,7 @@
     /*
      * Error out if cwd is writable by others.
      */
-    if (dir_info.st_mode & S_IWOTH) {
+    if ((dir_info.st_mode & S_IWOTH) || (dir_info.st_mode & S_IWGRP)) {
 	log_err("error: directory is writable by others: (%s)\n", cwd);
 	exit(116);
     }
@@ -548,7 +542,7 @@
     /*
      * Error out if the program is writable by others.
      */
-    if (prg_info.st_mode & S_IWOTH) {
+    if ((prg_info.st_mode & S_IWOTH) || (prg_info.st_mode & S_IWGRP)) {
 	log_err("error: file is writable by others: (%s/%s)\n", cwd, cmd);
 	exit(118);
     }

