linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev does not handle correctly multi links
@ 2004-10-04 14:51 Matias Feliciano
  0 siblings, 0 replies; only message in thread
From: Matias Feliciano @ 2004-10-04 14:51 UTC (permalink / raw)
  To: linux-hotplug


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

Sorry for my English.

As Harald Hoyer request, I forward a fix (see attachment) for multi
links in one rule.

The patch in attachment is again a vanilla udev-032.
I don't test this patch !
It also content some patch from Fedora (mainly udev-030-symlink.patch
from udev-032-7).


My original patch is again udev-032-7 from Fedore Core rawhide.
it can be find here :
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=104682&action=view
or here :
http://feliciano.matias.free.fr/udev/ (udev-032-symlink2.patch)
It only apply after all Red Hat patchs.


For the record :
bug in redhat bugzilla :
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=134478
An explanation in fedora-test-list mailing :
http://www.redhat.com/archives/fedora-test-list/2004-October/msg00202.html


Thanks for udev ;-)

[-- Attachment #1.2: udev-032-symlink.patch --]
[-- Type: text/x-patch, Size: 2207 bytes --]

diff -urN udev-032.orig/dev_d.c udev-032/dev_d.c
--- udev-032.orig/dev_d.c	2004-09-14 07:55:37.000000000 +0200
+++ udev-032/dev_d.c	2004-10-04 16:16:39.526353541 +0200
@@ -65,21 +65,39 @@
 {
 	char dirname[256];
 	char env_devname[NAME_SIZE];
+	char env_symlink[NAME_SIZE];
 	char *devname;
 	char *temp;
 
 	if (udev_dev_d == 0)
 		return;
 
+	env_devname[0] = 0;
+	env_symlink[0] = 0;
+
 	if (dev->type == 'b' || dev->type == 'c') {
+		char *pos;
+		int len;
+		char namelink[NAME_SIZE];
 		strfieldcpy(env_devname, udev_root);
 		strfieldcat(env_devname, dev->name);
+		foreach_strpart(dev->symlink, " ", pos, len) {
+			if (env_symlink[0] != '\0') {
+				strfieldcat(env_symlink, " ");
+			}
+			strfieldcat(env_symlink, udev_root);
+			strncpy(namelink, pos, len);
+			namelink[len] = '\0';
+			strfieldcat(env_symlink, namelink);
+		}
 	} else if (dev->type == 'n') {
 		strfieldcpy(env_devname, dev->name);
 		setenv("DEVPATH", devpath, 1);
 	}
 	setenv("DEVNAME", env_devname, 1);
 	dbg("DEVNAME='%s'", env_devname);
+	setenv("SYMLINK", env_symlink, 1);
+	dbg("SYMLINK='%s'", env_symlink);
 
 	devname = strdup(dev->name);
 	if (!devname) {
diff -urN udev-032.orig/namedev.c udev-032/namedev.c
--- udev-032.orig/namedev.c	2004-09-14 07:55:36.000000000 +0200
+++ udev-032/namedev.c	2004-10-04 16:16:39.528353173 +0200
@@ -898,14 +898,18 @@
 
 			if (dev->symlink[0] != '\0') {
 				char temp[NAME_SIZE];
-
+				char *p;
+				int len;
 				info("configured rule in '%s' at line %i applied, added symlink '%s'",
 				     dev->config_file, dev->config_line, dev->symlink);
-				strfieldcpy(temp, dev->symlink);
-				apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device);
-				if (udev->symlink[0] != '\0')
-					strfieldcat(udev->symlink, " ");
-				strfieldcat(udev->symlink, temp);
+				foreach_strpart(dev->symlink, " ", p, len) {
+					strncpy(temp, p, len);
+					temp[len] = '\0';
+					apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device);
+					if (udev->symlink[0] != '\0')
+						strfieldcat(udev->symlink, " ");
+					strfieldcat(udev->symlink, temp);
+				}
 			}
 
 			if (dev->name[0] != '\0') {

[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-04 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-04 14:51 udev does not handle correctly multi links Matias Feliciano

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).