<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">*** exim-4.10/src/daemon.c  Mon Jul 22 09:59:48 2002
- --- daemon.c Wed Dec  4 10:52:04 2002
***************
*** 960,991 ****
    (b) When -bd is used and -oX is not used, or
    (c) When -oP is used to supply a path.

! The variable daemon_write_pid is used to control this.

- - Note re use of sprintf: spool_directory and pid_file_path are checked on
- - input to be &lt; 200 characters. */
- -
  if (running_in_test_harness || daemon_write_pid)
    {
    FILE *f;
- -   uschar buff[256];
- -
    if (pid_file_path[0] == 0)
!     sprintf(CS buff, "%s/exim-daemon.pid", spool_directory);
!   else
!     sprintf(CS buff, CS pid_file_path, "");   /* Backward compatibility */

!   f = Ufopen(buff, "wb");
    if (f != NULL)
      {
      fprintf(f, "%d\n", (int)getpid());
      fchmod(fileno(f), 0644);
      fclose(f);
!     DEBUG(D_any) debug_printf("pid written to %s\n", buff);
      }
    else
      DEBUG(D_any)
!       debug_printf("%s\n", string_open_failed(errno, "pid file %s", buff));
    }

  /* Set up the handler for SIGHUP, which causes a restart of the daemon. */
- --- 960,987 ----
    (b) When -bd is used and -oX is not used, or
    (c) When -oP is used to supply a path.

! The variable daemon_write_pid is used to control this. */

  if (running_in_test_harness || daemon_write_pid)
    {
    FILE *f;
    if (pid_file_path[0] == 0)
!     pid_file_path = string_sprintf("%s/exim-daemon.pid", spool_directory);

!   f = Ufopen(pid_file_path, "wb");
    if (f != NULL)
      {
      fprintf(f, "%d\n", (int)getpid());
      fchmod(fileno(f), 0644);
      fclose(f);
!     DEBUG(D_any) debug_printf("pid written to %s\n", pid_file_path);
      }
    else
+     {
      DEBUG(D_any)
!       debug_printf("%s\n", string_open_failed(errno, "pid file %s",
!         pid_file_path));
!     }
    }

  /* Set up the handler for SIGHUP, which causes a restart of the daemon. */
</pre></body></html>