Please include comments when sending patches to the list.
Yes we spoke about it 5 minutes ago, but not everyone is on IRC or
will come across within the next year.
ACK with a proper commit message
On Mon, Dec 20, 2010 at 10:37 PM, Adam Stokes <astokes(a)fedoraproject.org> wrote:
---
src/lib/network_windows.c | 54 +++++++++++++++++++++++++++++---------------
1 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/src/lib/network_windows.c b/src/lib/network_windows.c
index d8cc03d..d735ef3 100644
--- a/src/lib/network_windows.c
+++ b/src/lib/network_windows.c
@@ -28,43 +28,59 @@
#include <config.h>
-#include <spawn.h>
+#include <glib.h>
#include <windows.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windns.h>
-#include <iphlpapi.h>
-#include <process.h>
-
-#define GAA_FLAGS ( GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_MULTICAST |
GAA_FLAG_SKIP_ANYCAST )
-#define BUFSIZE 1024
void
network_os_stop(const char *iface)
{
- char *exe_path;
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
char *p;
- gint r;
+ char *exe_path;
p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh", p);
+ exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface %s
disabled", p, iface);
+
+ gboolean ok = CreateProcess(NULL,
+ exe_path,
+ NULL,
+ NULL,
+ TRUE,
+ 0,
+ NULL,
+ NULL,
+ &si,
+ &pi);
- r = _spawnl(_P_WAIT, exe_path, exe_path, "interface",
- "set", "interface", iface, "disabled",
NULL);
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
g_free(exe_path);
}
void
network_os_start(const char *iface)
{
- char *exe_path;
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
char *p;
- gint r;
+ char *exe_path;
p = getenv("WINDIR");
- exe_path = g_strdup_printf("%s\\system32\\netsh", p);
+ exe_path = g_strdup_printf("%s\\system32\\netsh interface set interface %s
enabled", p, iface);
+
+ gboolean ok = CreateProcess(NULL,
+ exe_path,
+ NULL,
+ NULL,
+ TRUE,
+ 0,
+ NULL,
+ NULL,
+ &si,
+ &pi);
- r = _spawnl(_P_WAIT, exe_path, exe_path, "interface",
- "set", "interface", iface, "enabled",
NULL);
+ CloseHandle(pi.hThread);
+ CloseHandle(pi.hProcess);
g_free(exe_path);
}
--
1.7.3.3
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari