Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37410490
en ru br
Репозитории ALT
S:1.44.0-alt2
5.1: 0.7.3-alt2.git20101007.M51.1
4.1: 0.7.1-alt5.M41.5
www.altlinux.org/Changes

Группа :: Система/Настройка/Сеть
Пакет: NetworkManager

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: NetworkManager-0.7.0-alt-kill_supplicant.patch
Скачать


diff --git NetworkManager/src/supplicant-manager/nm-supplicant-interface.c NetworkManager/src/supplicant-manager/nm-supplicant-interface.c
index 43cd167..8ceb3b2 100644
--- NetworkManager/src/supplicant-manager/nm-supplicant-interface.c
+++ NetworkManager/src/supplicant-manager/nm-supplicant-interface.c
@@ -22,6 +22,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
+/*strtoul(), kill() end errno in kill_wpa_supplicant()*/
+#include <stdlib.h>
+#include <errno.h>
+#include <signal.h>
+/*sleep()*/
+#include <unistd.h>
 
 #include "nm-supplicant-interface.h"
 #include "nm-supplicant-manager.h"
@@ -725,6 +731,33 @@ nm_supplicant_interface_add_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpoi
 	}
 }
 
+static void 
+kill_wpa_supplicant (const char *iface)
+{
+	char *pidfile = NULL;
+	char *pid_contents = NULL;
+	
+	g_assert(iface != NULL);
+
+	pidfile = g_strdup_printf("/var/run/wpa_supplicant-%s.pid", iface);
+	g_assert(pidfile != NULL);
+
+	if (g_file_get_contents (pidfile, &pid_contents, NULL, NULL))
+	{
+		unsigned long int pid = strtoul (pid_contents, NULL, 10);
+		if ( !((pid == ULONG_MAX) && (errno == ERANGE)) ) 
+		{
+			if(!kill((pid_t)pid, SIGTERM))
+			{
+				remove (pidfile);
+				sleep(1);
+			}
+		}
+		g_free(pid_contents);
+	}
+	g_free(pidfile);
+}
+
 static void
 nm_supplicant_interface_add_to_supplicant (NMSupplicantInterface * self,
                                            gboolean get_only)
@@ -757,6 +790,8 @@ nm_supplicant_interface_add_to_supplicant (NMSupplicantInterface * self,
 		g_value_set_string (driver, priv->is_wireless ? "wext" : "wired");
 		g_hash_table_insert (hash, "driver", driver);
 
+		kill_wpa_supplicant(priv->dev);
+
 		call = dbus_g_proxy_begin_call (proxy,
 										"addInterface",
 										nm_supplicant_interface_add_cb,
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin