Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 26764e702e441b473525f6a16ac25557 > files > 21

hal-0.5.8.1-59.el5.src.rpm

--- hald/linux/probing/probe-volume.c	2006-09-20 01:53:25.000000000 +0530
+++ hald/linux/probing/probe-volume.c.new	2009-03-03 10:26:37.000000000 +0530
@@ -309,10 +309,12 @@
 	dbus_bool_t should_probe_for_fs;
 	dbus_uint64_t vol_probe_offset = 0;
 	LibHalChangeSet *cs;
+	gboolean disc_may_have_data;
 	fd = -1;
 
 
 	cs = NULL;
+	disc_may_have_data = FALSE;
 
 	/* hook in our debug into libvolume_id */
 	volume_id_log_fn = vid_log;
@@ -421,8 +423,19 @@
 			libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", TRUE);
 			/* set the volume size to 0 if disc is blank and not as 4 from BLKGETSIZE64 */
 			libhal_changeset_set_property_int (cs, "volume.block_size", 0);
-			HAL_DEBUG(("Disc in %s is blank", device_file));
-			should_probe_for_fs = FALSE;
+			HAL_DEBUG(("Disc in %s probably blank", device_file));
+			/*
+			 * blank discs normally return 0x0800 (probably for the TOC) - if it's larger,
+			 * it probably means that the drive/firmware is bad and CDROM_DISC_STATUS lies.
+			 * In this case, actually try to probe for a file system. See RH #186334 for
+			 * details: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=186334
+			 */
+			if (vol_size > 0x800) {
+				should_probe_for_fs = TRUE;
+				disc_may_have_data = TRUE;
+			} else {
+				should_probe_for_fs = FALSE;
+			}
 			break;
 			
 		default:		/* should never see this */
@@ -588,6 +601,10 @@
 		if (vid != NULL) {
 			if (volume_id_probe_all (vid, vol_probe_offset , vol_size) == 0) {
 				set_volume_id_values(ctx, udi, cs, vid);
+				if(disc_may_have_data) {
+					libhal_changeset_set_property_bool(cs, "volume.disc.is_blank", FALSE);
+					libhal_changeset_set_property_bool(cs, "volume.disc.has_data", TRUE);
+				}
 			} else {
 				libhal_changeset_set_property_string (cs, "info.product", "Volume");
 			}