Author: mturk
Date: Sun Feb 21 06:44:24 2010
New Revision: 912303
URL: http://svn.apache.org/viewvc?rev=912303&view=rev
Log:
Lock the file during logging so that mutiple processes can write safely
Modified:
tomcat/jk/trunk/native/common/jk_util.c
Modified: tomcat/jk/trunk/native/common/jk_util.c
URL:
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_util.c?rev=912303&r1=912302&r2=912303&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_util.c (original)
+++ tomcat/jk/trunk/native/common/jk_util.c Sun Feb 21 06:44:24 2010
@@ -542,9 +542,17 @@
if (p->logfile) {
what[used++] = '\n';
what[used] = '\0';
+#if defined(WIN32) && defined(_MSC_VER)
+ LockFile((HANDLE)_get_osfhandle(_fileno(p->logfile)),
+ 0, 0, 1, 0);
+#endif
fputs(what, p->logfile);
/* [V] Flush the dam' thing! */
fflush(p->logfile);
+#if defined(WIN32) && defined(_MSC_VER)
+ UnlockFile((HANDLE)_get_osfhandle(_fileno(p->logfile)),
+ 0, 0, 1, 0);
+#endif
}
return JK_TRUE;
}
@@ -627,6 +635,8 @@
rc->logger_private = p;
#if defined(AS400) && !defined(AS400_UTF8)
p->logfile = fdopen(fd, "a+, o_ccsid=0");
+#elif defined(WIN32) && defined(_MSC_VER)
+ p->logfile = fdopen(fd, "a+c");
#else
p->logfile = fdopen(fd, "a+");
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]