Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / ircd.c
index ededf241ae1b8d78a60b5a5dc1411b48cf93e05b..31ecd8a043b3daaf7ccd6b4dc7ae7c7744143fb1 100644 (file)
  *
  * $Id$
  */
-
-
-/*----------------------------------------------------------------------------
- * Platform Includes
- *--------------------------------------------------------------------------*/
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <netdb.h>
-
-
-/*----------------------------------------------------------------------------
- * ircu Includes
- *--------------------------------------------------------------------------*/
-#include "config.h"
+#include "ircd.h"
 
 #include "IPcheck.h"
 #include "class.h"
 #include "client.h"
 #include "crule.h"
 #include "hash.h"
-#include "ircd.h"
 #include "ircd_alloc.h"
 #include "ircd_log.h"
 #include "ircd_reply.h"
 #include "version.h"
 #include "whowas.h"
 
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+
 
 /*----------------------------------------------------------------------------
  * External stuff
@@ -559,12 +550,12 @@ static char set_chroot_environment(void) {
   if (geteuid())
     seteuid(0);
 
-  if (chdir(DPATH)) {
-    fprintf(stderr, "Fail: Cannot chdir(%s): %s\n", DPATH, strerror(errno));
+  if (chdir(dpath)) {
+    fprintf(stderr, "Fail: Cannot chdir(%s): %s\n", dpath, strerror(errno));
     return 0;
   }
-  if (chroot(DPATH)) {
-    fprintf(stderr, "Fail: Cannot chroot(%s): %s\n", DPATH, strerror(errno));
+  if (chroot(dpath)) {
+    fprintf(stderr, "Fail: Cannot chroot(%s): %s\n", dpath, strerror(errno));
     return 0;
   }
   dpath = "/";
@@ -638,7 +629,7 @@ int main(int argc, char **argv) {
 
   /* Check paths for accessibility */
   if (!check_file_access(SPATH, 'S', X_OK) ||
-      !check_file_access(CPATH, 'C', R_OK) ||
+      !check_file_access(configfile, 'C', R_OK) ||
       !check_file_access(MPATH, 'M', R_OK) ||
       !check_file_access(RPATH, 'R', R_OK))
     exit(4);