*** log.c       Tue Aug 28 09:16:39 2001
--- log.new.c   Tue Aug 28 09:26:41 2001
***************
*** 80,85 ****
--- 80,86 ----
      time_t gmt;
      struct tm *timeptr;

+     log_open();
      if(level>options.debug_level)
          return;
      va_start(arglist, format);
***************
*** 92,97 ****
--- 93,99 ----
  #ifndef USE_WIN32
      if(!outfile && !options.foreground) {
          syslog(level, "%s", text);
+         log_close();
          return;
      }
  #endif
***************
*** 103,108 ****
--- 105,111 ----
          timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec,
          level, process_id(), thread_id(), text);
      fflush(out);
+     log_close();
  }

  /* End of log.c */
*** stunnel.c   Tue Aug 28 09:16:25 2001
--- stunnel.new.c       Tue Aug 28 09:26:43 2001
***************
*** 97,103 ****
      parse_options(argc, argv);
      if(!(options.option&OPT_FOREGROUND))
          options.foreground=0;
-     log_open();
      log(LOG_NOTICE, "Using '%s' as tcpwrapper service name",
options.servname);

      /* check if certificate exists */
--- 97,102 ----
***************
*** 140,146 ****
      }
      /* close SSL */
      context_free(); /* free global SSL context */
-     log_close();
      return 0; /* success */
  }

--- 139,144 ----
