--- build-tree-apache.orig/apache_1.3.33/src/support/suexec.c	2004-02-20 23:02:24.000000000 +0100
+++ build-tree-apache/apache_1.3.33/src/support/suexec.c	2005-09-26 01:18:19.000000000 +0200
@@ -478,12 +478,17 @@
 	}
     }
     else {
-	if (((chdir(DOC_ROOT)) != 0) ||
-	    ((getcwd(dwd, AP_MAXPATH)) == NULL) ||
-	    ((chdir(cwd)) != 0)) {
-	    log_err("emerg: cannot get docroot information (%s)\n", DOC_ROOT);
+	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 ((strncmp(cwd, dwd, strlen(dwd))) != 0) {
@@ -502,7 +507,7 @@
     /*
      * Error out if cwd is writable by others.
      */
-    if ((dir_info.st_mode & S_IWOTH) || (dir_info.st_mode & S_IWGRP)) {
+    if (dir_info.st_mode & S_IWOTH) {
 	log_err("error: directory is writable by others: (%s)\n", cwd);
 	exit(116);
     }
@@ -518,7 +523,7 @@
     /*
      * Error out if the program is writable by others.
      */
-    if ((prg_info.st_mode & S_IWOTH) || (prg_info.st_mode & S_IWGRP)) {
+    if (prg_info.st_mode & S_IWOTH) {
 	log_err("error: file is writable by others: (%s/%s)\n", cwd, passedargv[0]);
 	exit(118);
     }

