Fix reporting of 2-phase queue-runner daemon, in daemon start log line and in exiwhat
[exim.git] / src / src / spool_mbox.c
index caf1712cf7dde5619870e963826ed769e7b6dff5..8996f443a16c5b33d938b414fa68dcc8a53a6997 100644 (file)
@@ -117,7 +117,7 @@ if (!spool_mbox_ok)
     message_subdir[1] = '\0';
     for (int i = 0; i < 2; i++)
       {
-      message_subdir[0] = split_spool_directory == (i == 0) ? message_id[5] : 0;
+      set_subdir_str(message_subdir, message_id, i);
       temp_string = spool_fname(US"input", message_subdir, message_id, US"-D");
       if ((l_data_file = Ufopen(temp_string, "rb"))) break;
       }
@@ -211,12 +211,11 @@ malware_ok = 0;
 if (spool_mbox_ok && !f.no_mbox_unspool)
   {
   uschar *file_path;
-  struct dirent *entry;
   DIR *tempdir;
   rmark reset_point = store_mark();
   uschar * mbox_path = string_sprintf("%s/scan/%s", spool_directory, spooled_message_id);
 
-  if (!(tempdir = opendir(CS mbox_path)))
+  if (!(tempdir = exim_opendir(mbox_path)))
     {
     debug_printf("Unable to opendir(%s): %s\n", mbox_path, strerror(errno));
     /* Just in case we still can: */
@@ -224,7 +223,7 @@ if (spool_mbox_ok && !f.no_mbox_unspool)
     return;
     }
   /* loop thru dir & delete entries */
-  while((entry = readdir(tempdir)))
+  for (struct dirent *entry; entry = readdir(tempdir); )
     {
     uschar *name = US entry->d_name;
     int dummy;