diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-03-12 08:49:12 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-03-13 17:18:30 +0000 |
commit | a2f926761525ac67feeda742a796917a1f043b33 (patch) | |
tree | cf79825b1d983633dc7d7f6d1a28ec2fe70dfa1e /sharkd_daemon.c | |
parent | 0874b8bac6ca89f1d91d30d66d54f425e4e7c81e (diff) |
Windows: Always assign newly-created processes to our job.
Move ws_pipe_kill_child_on_exit to win32-utils. Add win32_create_process,
which calls CreateProcess + AssignProcessToJobObject. Use
win32_create_process instead of CreateProcess everywhere.
Bug: 1419
Change-Id: I7a1f17dddf6a73f6973d54621f271b69311400d1
Reviewed-on: https://code.wireshark.org/review/26448
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'sharkd_daemon.c')
-rw-r--r-- | sharkd_daemon.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sharkd_daemon.c b/sharkd_daemon.c index 4f98ef48cb..89af1ebcb5 100644 --- a/sharkd_daemon.c +++ b/sharkd_daemon.c @@ -37,6 +37,7 @@ #endif #include <wsutil/strtoi.h> +#include <wsutil/win32-utils.h> #include "sharkd.h" @@ -232,7 +233,6 @@ sharkd_loop(void) PROCESS_INFORMATION pi; STARTUPINFO si; char *exename; - gunichar2 *commandline; #endif socket_handle_t fd; @@ -273,11 +273,10 @@ sharkd_loop(void) si.hStdError = GetStdHandle(STD_ERROR_HANDLE); exename = g_strdup_printf("%s\\%s", get_progfile_dir(), "sharkd.exe"); - commandline = g_utf8_to_utf16("sharkd.exe -", -1, NULL, NULL, NULL); - if (!CreateProcess(utf_8to16(exename), commandline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) + if (!win32_create_process(exename, "sharkd.exe -", NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { - fprintf(stderr, "CreateProcess(%s) failed\n", exename); + fprintf(stderr, "win32_create_process(%s) failed\n", exename); } else { @@ -285,7 +284,6 @@ sharkd_loop(void) } g_free(exename); - g_free(commandline); #endif closesocket(fd); |