* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
#endif
#include <wsutil/socket.h>
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
+#include <wsutil/inet_addr.h>
#ifndef _WIN32
#include <sys/un.h>
#endif
#include <wsutil/strtoi.h>
+#include <wsutil/win32-utils.h>
#include "sharkd.h"
return INVALID_SOCKET;
s_in.sin_family = AF_INET;
- s_in.sin_addr.s_addr = inet_addr(path);
+ ws_inet_pton4(path, &(s_in.sin_addr.s_addr));
s_in.sin_port = g_htons(port);
*port_sep = ':';
PROCESS_INFORMATION pi;
STARTUPINFO si;
char *exename;
- gunichar2 *commandline;
#endif
socket_handle_t fd;
pid = fork();
if (pid == 0)
{
+ closesocket(_server_fd);
/* redirect stdin, stdout to socket */
dup2(fd, 0);
dup2(fd, 1);
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
{
}
g_free(exename);
- g_free(commandline);
#endif
closesocket(fd);