You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/07/16 22:46:23 UTC
cvs commit: apr/file_io/win32 filedup.c open.c
wrowe 01/07/16 13:46:23
Modified: file_io/win32 filedup.c open.c
Log:
Introduce opening a file inheritable on Win32, and some general text cleanup.
Revision Changes Path
1.33 +1 -1 apr/file_io/win32/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/filedup.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- filedup.c 2001/06/27 19:40:39 1.32
+++ filedup.c 2001/07/16 20:46:23 1.33
@@ -59,7 +59,7 @@
#include <string.h>
APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
- apr_file_t *old_file, apr_pool_t *p)
+ apr_file_t *old_file, apr_pool_t *p)
{
BOOLEAN isStdHandle = FALSE;
HANDLE hCurrentProcess = GetCurrentProcess();
1.78 +12 -9 apr/file_io/win32/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- open.c 2001/06/27 19:40:41 1.77
+++ open.c 2001/07/16 20:46:23 1.78
@@ -173,14 +173,11 @@
apr_int32_t flag, apr_fileperms_t perm,
apr_pool_t *cont)
{
- /* XXX: The default FILE_FLAG_SEQUENTIAL_SCAN is _wrong_ for
- * sdbm and any other random files! We _must_ rethink
- * this approach.
- */
+ SECURITY_ATTRIBUTES sa, *psa = NULL;
HANDLE handle = INVALID_HANDLE_VALUE;
DWORD oflags = 0;
DWORD createflags = 0;
- DWORD attributes = 0 /* FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN*/;
+ DWORD attributes = 0;
DWORD sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE;
apr_oslevel_e os_level;
apr_status_t rv;
@@ -221,7 +218,7 @@
if (flag & APR_DELONCLOSE) {
attributes |= FILE_FLAG_DELETE_ON_CLOSE;
}
- if (flag & APR_OPENLINK) {
+ if (flag & APR_OPENLINK) {
attributes |= FILE_FLAG_OPEN_REPARSE_POINT;
}
if (!(flag & (APR_READ | APR_WRITE)) && (os_level >= APR_WIN_NT)) {
@@ -236,6 +233,12 @@
*/
attributes |= FILE_FLAG_OVERLAPPED;
}
+ if (flag & APR_INHERIT) {
+ sa.nLength = sizeof(sa);
+ sa.bInheritHandle = TRUE;
+ sa.lpSecurityDescriptor = NULL;
+ psa = &sa;
+ }
#if APR_HAS_UNICODE_FS
if (os_level >= APR_WIN_NT) {
@@ -244,12 +247,12 @@
/ sizeof(apr_wchar_t), fname))
return rv;
handle = CreateFileW(wfname, oflags, sharemode,
- NULL, createflags, attributes, 0);
+ psa, createflags, attributes, 0);
}
else
#endif
handle = CreateFileA(fname, oflags, sharemode,
- NULL, createflags, attributes, 0);
+ psa, createflags, attributes, 0);
if (handle == INVALID_HANDLE_VALUE) {
return apr_get_os_error();
@@ -307,7 +310,7 @@
(*new)->filePtr = 0;
apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), file_cleanup,
- apr_pool_cleanup_null);
+ apr_pool_cleanup_null);
return APR_SUCCESS;
}