Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 94178 invoked by uid 500); 31 Mar 2001 22:32:49 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 94156 invoked by uid 1121); 31 Mar 2001 22:32:47 -0000 Date: 31 Mar 2001 22:32:47 -0000 Message-ID: <20010331223247.94155.qmail@apache.org> From: trawick@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/file_io/win32 open.c trawick 01/03/31 14:32:47 Modified: . CHANGES file_io/win32 open.c Log: Flush any data still unwritten when the file is closed. (Note: On Unix we need to move the flush from apr_file_close() to the cleanup routine.) Revision Changes Path 1.79 +5 -0 apr/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apr/CHANGES,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- CHANGES 2001/03/31 12:23:39 1.78 +++ CHANGES 2001/03/31 22:32:46 1.79 @@ -1,5 +1,10 @@ Changes with APR b1 + *) Misc. Win32 fixes: Set the pool pointer in apr_sockaddr_t + structures created with the apr_socket_t to prevent segfault + in certain apps. Flush unwritten buffered data when the file + is closed. [Jeff Trawick] + *) Win32: Get APR to compile with MSVC 5.0 (a.k.a. VC97). PR #7489 [Jeff Trawick] 1.73 +6 -1 apr/file_io/win32/open.c Index: open.c =================================================================== RCS file: /home/cvs/apr/file_io/win32/open.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- open.c 2001/03/23 22:52:30 1.72 +++ open.c 2001/03/31 22:32:46 1.73 @@ -153,7 +153,12 @@ apr_status_t file_cleanup(void *thefile) { apr_file_t *file = thefile; + apr_status_t flush_rv = APR_SUCCESS; + if (file->filehand != INVALID_HANDLE_VALUE) { + if (file->buffered) { + flush_rv = apr_file_flush((apr_file_t *)thefile); + } CloseHandle(file->filehand); file->filehand = INVALID_HANDLE_VALUE; } @@ -161,7 +166,7 @@ CloseHandle(file->pOverlapped->hEvent); file->pOverlapped = NULL; } - return APR_SUCCESS; + return flush_rv; } APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname,