From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Wed, 05 Apr 2006 17:51:06 +0000 Subject: [PATCH] Make saved environment available for remove event rules Message-Id: <200604052151.09087.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="nextPart12176234.64km2E2Ji2" List-Id: To: linux-hotplug@vger.kernel.org --nextPart12176234.64km2E2Ji2 Content-Type: multipart/mixed; boundary="Boundary-01=_MOANEBCbyONxZ0j" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_MOANEBCbyONxZ0j Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --- Patch attached due to kmail customarily mangling long lines :( -andrey --Boundary-01=_MOANEBCbyONxZ0j Content-Type: text/x-diff; charset="us-ascii"; name="make_save_environment_avaialble_for_remove_rules.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="make_save_environment_avaialble_for_remove_rules.diff" Subject: [PATCH] Make saved environment available for remove event rules =46rom: Andrey Borzenkov 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=3Dlinux-hotplug-devel&m=3D114416867706787&w= =3D2 Signed-off-by: Andrey Borzenkov =2D-- 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 =2D-- a/udev_device.c +++ b/udev_device.c @@ -101,6 +101,10 @@ int udev_device_event(struct udev_rules=20 if (major(udev->devt) !=3D 0 && strcmp(udev->action, "remove") =3D=3D 0) { struct name_entry *name_loop; =20 + 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=20 /* get data from db, remove db-entry, delete node */ retval =3D udev_remove_device(udev); =20 =2D /* restore stored persistent data */ =2D list_for_each_entry(name_loop, &udev->env_list, node) =2D putenv(name_loop->name); return retval; } =20 diff --git a/udev_remove.c b/udev_remove.c index 6de6cf5..f4c9ab6 100644 =2D-- a/udev_remove.c +++ b/udev_remove.c @@ -119,7 +119,7 @@ int udev_remove_device(struct udevice *u if (major(udev->devt) =3D=3D 0) return 0; =20 =2D if (udev_db_get_device(udev, udev->dev->devpath) =3D=3D 0) { + if (udev->name[0] !=3D '\0') { if (udev->ignore_remove) { dbg("remove event for '%s' requested to be ignored by rule", udev->name= ); return 0; --Boundary-01=_MOANEBCbyONxZ0j-- --nextPart12176234.64km2E2Ji2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBENAONR6LMutpd94wRAqvjAKCxrRPuRzL8RjHICu+htJkjcP32ugCcCfkU x+pXtUBN+KpG99zPjiw261Q= =eO6D -----END PGP SIGNATURE----- --nextPart12176234.64km2E2Ji2-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel