linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make saved environment available for remove event rules
@ 2006-04-05 17:51 Andrey Borzenkov
  2006-04-05 20:46 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Borzenkov @ 2006-04-05 17:51 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 477 bytes --]

The patch assures that saved environment is available when processing
rules for 'remove' event. It enables mathing on previously set variables.
Among others it makes REMOVE_CMD really works (Debian bug 360855).

This is slightly modified version of patch from this thread:
http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---
Patch attached due to kmail customarily mangling long lines :(

-andrey

[-- Attachment #1.2: make_save_environment_avaialble_for_remove_rules.diff --]
[-- Type: text/x-diff, Size: 1989 bytes --]

Subject: [PATCH] Make saved environment available for remove event rules

From: Andrey Borzenkov <arvidjaar@mail.ru>

The patch assures that saved environment is available when processing
rules for 'remove' event. It enables mathing on previously set variables.
Among others it makes REMOVE_CMD really works (Debian bug 360855).

This is slightly modified version of patch from this thread:
http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 udev_device.c |    7 ++++---
 udev_remove.c |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/udev_device.c b/udev_device.c
index 5db2709..6ee6b13 100644
--- a/udev_device.c
+++ b/udev_device.c
@@ -101,6 +101,10 @@ int udev_device_event(struct udev_rules 
 	if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) {
 		struct name_entry *name_loop;
 
+		udev_db_get_device(udev, udev->dev->devpath);
+		/* restore stored persistent data */
+		list_for_each_entry(name_loop, &udev->env_list, node)
+			putenv(name_loop->name);
 		udev_rules_get_run(rules, udev);
 		if (udev->ignore_device) {
 			info("device event will be ignored");
@@ -109,9 +113,6 @@ int udev_device_event(struct udev_rules 
 		/* get data from db, remove db-entry, delete node */
 		retval = udev_remove_device(udev);
 
-		/* restore stored persistent data */
-		list_for_each_entry(name_loop, &udev->env_list, node)
-			putenv(name_loop->name);
 		return retval;
 	}
 
diff --git a/udev_remove.c b/udev_remove.c
index 6de6cf5..f4c9ab6 100644
--- a/udev_remove.c
+++ b/udev_remove.c
@@ -119,7 +119,7 @@ int udev_remove_device(struct udevice *u
 	if (major(udev->devt) == 0)
 		return 0;
 
-	if (udev_db_get_device(udev, udev->dev->devpath) == 0) {
+	if (udev->name[0] != '\0') {
 		if (udev->ignore_remove) {
 			dbg("remove event for '%s' requested to be ignored by rule", udev->name);
 			return 0;

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-05 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-05 17:51 [PATCH] Make saved environment available for remove event rules Andrey Borzenkov
2006-04-05 20:46 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).