libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 025295135817d73d62ae9c4300f3b9eac81ae4b4
parent 450529ffbdded2af0e39ac4fb83d19814accd576
Author: LRN <lrn1986@gmail.com>
Date:   Sun,  3 Feb 2013 17:17:39 +0000

Use NUL on W32 as /dev/null, don't kill children outright

Diffstat:
Msrc/main/extractor_ipc_w32.c | 5+++--
Msrc/main/extractor_plugin_main.c | 10++++------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/main/extractor_ipc_w32.c b/src/main/extractor_ipc_w32.c @@ -588,8 +588,6 @@ EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel) { int status; - TerminateProcess (channel->hProcess, 0); - CloseHandle (channel->hProcess); CloseHandle (channel->cpipe_out); CloseHandle (channel->cpipe_in); CloseHandle (channel->ov_read.hEvent); @@ -602,6 +600,9 @@ EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel) if (NULL != channel->plugin) channel->plugin->channel = NULL; free (channel->mdata); + WaitForSingleObject (channel->hProcess, 1000); + TerminateProcess (channel->hProcess, 0); + CloseHandle (channel->hProcess); free (channel); } diff --git a/src/main/extractor_plugin_main.c b/src/main/extractor_plugin_main.c @@ -543,7 +543,6 @@ process_requests (struct ProcessingContext *pc) } -#ifndef WINDOWS /** * Open '/dev/null' and make the result the given * file descriptor. @@ -557,7 +556,11 @@ open_dev_null (int target_fd, { int fd; +#ifndef WINDOWS fd = open ("/dev/null", flags); +#else + fd = open ("\\\\?\\NUL", flags); +#endif if (-1 == fd) { LOG_STRERROR_FILE ("open", "/dev/null"); @@ -575,7 +578,6 @@ open_dev_null (int target_fd, if (0 != close (fd)) LOG_STRERROR ("close"); } -#endif /** @@ -605,18 +607,14 @@ EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin, { if (0 != close (2)) LOG_STRERROR ("close"); -#ifndef WINDOWS open_dev_null (2, O_WRONLY); -#endif } if ( (NULL != plugin->specials) && (NULL != strstr (plugin->specials, "close-stdout"))) { if (0 != close (1)) LOG_STRERROR ("close"); -#ifndef WINDOWS open_dev_null (1, O_WRONLY); -#endif } pc.plugin = plugin; pc.in = in;