hal/hald/linux block_class_device.c,1.22,1.23
David Zeuthen
david at pdx.freedesktop.org
Tue May 25 10:15:43 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv18027/hald/linux
Modified Files:
block_class_device.c
Log Message:
2004-05-25 David Zeuthen <david at fubar.dk>
* hald/linux/block_class_device.c (read_etc_mtab): hal doesn't
close the filedescriptor when it /etc/mtab wasn't changed of the
fstat failed. Also when closing a file stream opened with fdopen,
the original fd is also closed (the fdopen function doesn't dup
the fd). So the close after fclose is wrong. Patch from Sjoerd
Simons <sjoerd at luon.net>.
(detect_fs): When fs detection fails the volume_id struct wasn't
closed, causing a mem and fd leak. And as a side effect, causing
me to be unable to open my cd writer with the eject button when
there was a blank cd inside :). Patch from Sjoerd Simons
<sjoerd at luon.net>.
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- a/block_class_device.c 13 May 2004 21:21:32 -0000 1.22
+++ b/block_class_device.c 25 May 2004 17:15:41 -0000 1.23
@@ -761,8 +761,10 @@
return;
rc = volume_id_probe(vid, ALL);
- if (rc != 0)
+ if (rc != 0) {
+ volume_id_close(vid);
return;
+ }
hal_device_property_set_string (d, "volume.fstype", vid->fs_name);
if (vid->label_string[0] != '\0')
@@ -1268,11 +1270,13 @@
if (fstat (fd, &stat_buf) != 0) {
HAL_ERROR (("Cannot fstat /etc/mtab fd, errno=%d", errno));
+ close(fd);
return FALSE;
}
if (!force && etc_mtab_mtime == stat_buf.st_mtime) {
/*printf("No modification, etc_mtab_mtime=%d\n", etc_mtab_mtime); */
+ close(fd);
return FALSE;
}
@@ -1295,9 +1299,6 @@
}
fclose (f);
-
- close (fd);
-
return TRUE;
}
More information about the hal-commit
mailing list