]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows port: Redirect during early service startup stderr to a file.
authorserassio <>
Sat, 2 Sep 2006 19:21:00 +0000 (19:21 +0000)
committerserassio <>
Sat, 2 Sep 2006 19:21:00 +0000 (19:21 +0000)
This avoid the loss of fatal error info when running as a Windows service

src/win32.cc

index 3e0a89f844a429b5dd14d72df75e824baf2a72b1..2a8a73ab02d2028e8f8dbf76d565adb8ea9fa09f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: win32.cc,v 1.21 2006/09/02 13:14:25 serassio Exp $
+ * $Id: win32.cc,v 1.22 2006/09/02 13:21:00 serassio Exp $
  *
  * * * * * * * * Legal stuff * * * * * * *
  *
@@ -880,8 +880,13 @@ int main(int argc, char **argv)
                                               {NULL, NULL}
                                           };
     char *c;
+    char stderr_path[256];
 
     if ((argc == 2) && strstr(argv[1], _WIN_SQUID_SERVICE_OPTION)) {
+        strcpy(stderr_path, argv[0]);
+        strcat(stderr_path,".log");
+        freopen(stderr_path, "w", stderr);
+        setmode(fileno(stderr), O_TEXT);
         WIN32_run_mode = _WIN_SQUID_RUN_MODE_SERVICE;
         opt_no_daemon = 1;