From: serassio <> Date: Sat, 2 Sep 2006 19:21:00 +0000 (+0000) Subject: Windows port: Redirect during early service startup stderr to a file. X-Git-Tag: SQUID_3_0_PRE5~149 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=39d3c05f1fb8b42e4821bb8eb09bbcebe60f040d;p=thirdparty%2Fsquid.git Windows port: Redirect during early service startup stderr to a file. This avoid the loss of fatal error info when running as a Windows service --- diff --git a/src/win32.cc b/src/win32.cc index 3e0a89f844..2a8a73ab02 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -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;