tidying
[exim.git] / src / src / readconf.c
index 3654f19d1b4c1609be408425156de73d3db82e81..7396c8bd930f7c83694bdf262b5ac1f2dc9ae3a6 100644 (file)
@@ -2709,15 +2709,13 @@ if (type == NULL)
     if (environ)
       {
       uschar **p;
-      size_t n;
       for (p = USS environ; *p; p++) ;
-      n = p - USS environ;
       qsort(environ, p - USS environ, sizeof(*p), string_compare_by_pointer);
 
       for (p = USS environ; *p; p++)
         {
         if (no_labels) *(Ustrchr(*p, '=')) = '\0';
-        puts(*p);
+        puts(CS *p);
         }
       }
     return;
@@ -3049,14 +3047,6 @@ while((filename = string_nextinlist(&list, &sep, big_buffer, big_buffer_size))
        != NULL)
   {
 
-  /* To avoid confusion: Exim changes to / at the very beginning and
-   * and to $spool_directory later. */
-  if (filename[0] != '/')
-    {
-    fprintf(stderr, "-C %s: only absolute names are allowed\n", filename);
-    exit(EXIT_FAILURE);
-  }
-
   /* Cut out all the fancy processing unless specifically wanted */
 
   #if defined(CONFIGURE_FILE_USE_NODE) || defined(CONFIGURE_FILE_USE_EUID)
@@ -3110,6 +3100,15 @@ while((filename = string_nextinlist(&list, &sep, big_buffer, big_buffer_size))
   if (config_file != NULL || errno != ENOENT) break;
   }
 
+/* Now, once we found and opened our configuration file, we change the directory
+to a safe place. Later we change to $spool_directory. */
+
+if (Uchdir("/") < 0)
+  {
+  perror("exim: chdir `/': ");
+  exit(EXIT_FAILURE);
+  }
+
 /* On success, save the name for verification; config_filename is used when
 logging configuration errors (it changes for .included files) whereas
 config_main_filename is the name shown by -bP. Failure to open a configuration