hal/tools fstab-sync.c,1.11,1.12

David Zeuthen david at freedesktop.org
Mon Aug 23 03:08:51 PDT 2004


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv7234/tools

Modified Files:
	fstab-sync.c 
Log Message:
2004-08-23  David Zeuthen  <david at fubar.dk>

	* tools/fstab-sync.c (fs_table_has_volume): Properly resolve symlinks
	that aren't fully qualified



Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fstab-sync.c	22 Aug 2004 19:27:22 -0000	1.11
+++ fstab-sync.c	23 Aug 2004 10:08:48 -0000	1.12
@@ -1140,12 +1140,21 @@
 
 		  if (readlink (field->value, buf, sizeof (buf)) > 0) {
 
+		    /* check if link is fully qualified  */
+		    if (buf[0] != '/') {
+		      char buf1[256];
+		      char *p;
+
+		      strncpy (buf1, buf, sizeof (buf1));
+		      strncpy (buf, field->value, sizeof(buf));
+		      p = strrchr (buf, '/');
+		      strncpy (p+1, buf1, buf+sizeof(buf)-p-1);
+		    }
+
 		    if (strcmp (volume->block_device, buf) == 0) {
 		      /* update block.device with new value */
-		      fstab_update_debug (_("%d: Found %s pointing to %s in" _PATH_FSTAB), 
-					  pid, field->value, buf);
-		      hal_device_set_property_string (hal_context, volume->udi, 
-						      "block.device", field->value);
+		      fstab_update_debug (_("%d: Found %s pointing to %s in" _PATH_FSTAB), pid, field->value, buf);
+		      hal_device_set_property_string (hal_context, volume->udi, "block.device", field->value);
 		      return TRUE;
 		    }
 




More information about the hal-commit mailing list