hal/hald/linux block_class_device.c,1.84,1.85
David Zeuthen
david at freedesktop.org
Fri Oct 15 13:39:53 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv12391/hald/linux
Modified Files:
block_class_device.c
Log Message:
2004-10-15 David Zeuthen <davidz at redhat.com>
* hald/linux/block_class_device.c (detect_media): Fixup reuse
of file descriptors since we want O_NONBLOCK for polling and we
don't want to reuse that for probing the media (see below(
* hald/linux/volume_id/volume_id.c (volume_id_open_node): Never
use O_NONBLOCK since new kernel semantics can and will return
EAGAIN aka EWOULDBLOCK (see RH bug 135886).
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- block_class_device.c 8 Oct 2004 16:40:24 -0000 1.84
+++ block_class_device.c 15 Oct 2004 20:39:51 -0000 1.85
@@ -911,6 +911,8 @@
if (fd < 0)
return FALSE;
+ close (fd);
+
/* Now got_media==TRUE and fd>0.. So, Yay!, we got media
*
* See if we already got children (or children underway :-),
@@ -923,7 +925,6 @@
get_child_device_tdl (d);
}
if (child != NULL) {
- close (fd);
return FALSE;
}
@@ -1000,9 +1001,8 @@
HAL_INFO (("Detecting if %s contains a fs", device_file));
- vid = volume_id_open_fd (fd);
+ vid = volume_id_open_node (device_file);
if (vid == NULL) {
- close (fd);
g_object_unref (child);
return FALSE;
}
@@ -1011,15 +1011,14 @@
if (is_cdrom) {
/* volume_id cannot probe blank/audio discs etc,
* so don't fail for them, just set vid to NULL */
- volume_id_close (vid);
vid = NULL;
} else {
- close (fd);
g_object_unref (child);
volume_id_close (vid);
return FALSE;
}
}
+
}
/* Unfortunally, linux doesn't scan optical discs for partition
@@ -1032,7 +1031,6 @@
if (!no_partitions) {
if (vid != NULL)
volume_id_close (vid);
- close (fd);
g_object_unref (child);
return FALSE;
}
@@ -1072,12 +1070,11 @@
G_CALLBACK (class_device_move_from_tdl_to_gdl), cad);
hal_callout_device (child, TRUE);
- volume_id_close (vid);
- close (fd);
+ if (vid != NULL)
+ volume_id_close (vid);
return TRUE;
}
- close (fd);
return FALSE;
}
More information about the hal-commit
mailing list