From 366d7009b80072a5a957c7c9b637e3eeb21e7d06 Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Fri, 27 Jun 2008 19:26:36 -0500 Subject: [PATCH] Handle inheritance fixes for tools.deploy.test.5 --- extra/io/sockets/secure/secure-tests.factor | 8 ++++++++ extra/io/windows/files/files.factor | 2 +- extra/io/windows/nt/launcher/launcher.factor | 10 ++++------ extra/io/windows/nt/nt.factor | 1 + extra/io/windows/nt/pipes/pipes.factor | 4 ++-- extra/io/windows/sockets/sockets.factor | 3 +-- extra/io/windows/windows.factor | 5 ++++- 7 files changed, 21 insertions(+), 12 deletions(-) mode change 100644 => 100755 extra/io/sockets/secure/secure-tests.factor diff --git a/extra/io/sockets/secure/secure-tests.factor b/extra/io/sockets/secure/secure-tests.factor old mode 100644 new mode 100755 index 78de43d379..311127e333 --- a/extra/io/sockets/secure/secure-tests.factor +++ b/extra/io/sockets/secure/secure-tests.factor @@ -2,3 +2,11 @@ IN: io.sockets.secure.tests USING: accessors kernel io.sockets io.sockets.secure tools.test ; [ "hello" 24 ] [ "hello" 24 [ host>> ] [ port>> ] bi ] unit-test + +[ ] [ + + "resource:extra/openssl/test/server.pem" >>key-file + "resource:extra/openssl/test/dh1024.pem" >>dh-file + "password" >>password + [ ] with-secure-context +] unit-test diff --git a/extra/io/windows/files/files.factor b/extra/io/windows/files/files.factor index a4aae1a005..419509f124 100755 --- a/extra/io/windows/files/files.factor +++ b/extra/io/windows/files/files.factor @@ -10,7 +10,7 @@ IN: io.windows.files : open-file ( path access-mode create-mode flags -- handle ) [ - >r >r share-mode security-attributes-inherit r> r> + >r >r share-mode default-security-attributes r> r> CreateFile-flags f CreateFile opened-file ] with-destructors ; diff --git a/extra/io/windows/nt/launcher/launcher.factor b/extra/io/windows/nt/launcher/launcher.factor index 6c86b53049..ff11c456ca 100755 --- a/extra/io/windows/nt/launcher/launcher.factor +++ b/extra/io/windows/nt/launcher/launcher.factor @@ -46,7 +46,7 @@ IN: io.windows.nt.launcher path normalize-path access-mode share-mode - security-attributes-inherit + default-security-attributes create-mode FILE_ATTRIBUTE_NORMAL ! flags and attributes f ! template file @@ -58,11 +58,8 @@ IN: io.windows.nt.launcher redirect-file dup 0 FILE_END set-file-pointer ; -: set-inherit ( handle ? -- ) - >r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ; - : redirect-handle ( handle access-mode create-mode -- handle ) - 2drop handle>> duplicate-handle dup t set-inherit ; + 2drop handle>> duplicate-handle ; : redirect-stream ( stream access-mode create-mode -- handle ) >r >r underlying-handle handle>> r> r> redirect-handle ; @@ -75,7 +72,8 @@ IN: io.windows.nt.launcher { [ pick appender? ] [ redirect-append ] } { [ pick win32-file? ] [ redirect-handle ] } [ redirect-stream ] - } cond ; + } cond + dup [ dup t set-inherit ] when ; : redirect-stdout ( process args -- handle ) drop diff --git a/extra/io/windows/nt/nt.factor b/extra/io/windows/nt/nt.factor index 8e59a4d555..d79af52c5e 100755 --- a/extra/io/windows/nt/nt.factor +++ b/extra/io/windows/nt/nt.factor @@ -12,6 +12,7 @@ USE: io.windows.nt.sockets USE: io.windows.mmap USE: io.windows.files USE: io.backend +USE: openssl USE: system winnt set-io-backend diff --git a/extra/io/windows/nt/pipes/pipes.factor b/extra/io/windows/nt/pipes/pipes.factor index 97c2e49627..dc0d7cf1e5 100755 --- a/extra/io/windows/nt/pipes/pipes.factor +++ b/extra/io/windows/nt/pipes/pipes.factor @@ -16,13 +16,13 @@ IN: io.windows.nt.pipes 4096 4096 0 - security-attributes-inherit + default-security-attributes CreateNamedPipe opened-file ; : open-other-end ( name -- handle ) GENERIC_WRITE { FILE_SHARE_READ FILE_SHARE_WRITE } flags - security-attributes-inherit + default-security-attributes OPEN_EXISTING FILE_FLAG_OVERLAPPED f diff --git a/extra/io/windows/sockets/sockets.factor b/extra/io/windows/sockets/sockets.factor index 359776d639..d9ab10d5e3 100755 --- a/extra/io/windows/sockets/sockets.factor +++ b/extra/io/windows/sockets/sockets.factor @@ -7,8 +7,7 @@ HOOK: WSASocket-flags io-backend ( -- DWORD ) TUPLE: win32-socket < win32-file ; : ( handle -- win32-socket ) - win32-socket new - swap >>handle ; + win32-socket new-win32-handle ; M: win32-socket dispose ( stream -- ) handle>> closesocket drop ; diff --git a/extra/io/windows/windows.factor b/extra/io/windows/windows.factor index 5e10389c44..0892563a02 100755 --- a/extra/io/windows/windows.factor +++ b/extra/io/windows/windows.factor @@ -8,10 +8,13 @@ windows.shell32 windows.types windows.winsock splitting continuations math.bitfields system accessors ; IN: io.windows +: set-inherit ( handle ? -- ) + >r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ; + TUPLE: win32-handle handle disposed ; : new-win32-handle ( handle class -- win32-handle ) - new swap >>handle ; + new swap [ >>handle ] [ f set-inherit ] bi ; : ( handle -- win32-handle ) win32-handle new-win32-handle ;