hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Thu Dec 21 09:29:34 PST 2006


 hald/linux/addons/addon-storage.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

New commits:
diff-tree f33ffb6cb819b5f263a2742e5422532cf01f979d (from fc4a4c730c6afdbee3ed2e23aec19fb039752c5f)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Dec 21 12:29:31 2006 -0500

    remove unneeded close() calls
    
    Originally pointed out by Thomas Petazzoni <thomas.petazzoni at enix.org>.

diff --git a/hald/linux/addons/addon-storage.c b/hald/linux/addons/addon-storage.c
index 22247cf..2f06685 100644
--- a/hald/linux/addons/addon-storage.c
+++ b/hald/linux/addons/addon-storage.c
@@ -415,13 +415,11 @@ main (int argc, char *argv[])
 			fd = open (device_file, O_RDONLY);
 			if (fd < 0 && errno == ENOMEDIUM) {
 				got_media = FALSE;
-				close (fd);
 			} else if (fd >= 0) {
 				got_media = TRUE;
 				close (fd);
 			} else {
 				HAL_ERROR (("open failed for %s: %s", device_file, strerror (errno))); 
-				close (fd);
 				goto skip_check;
 			}
 		}
@@ -445,9 +443,10 @@ main (int argc, char *argv[])
 				
 				/* have to this to trigger appropriate hotplug events */
 				fd = open (device_file, O_RDONLY | O_NONBLOCK);
-				if (fd >= 0)
+				if (fd >= 0) {
 					ioctl (fd, BLKRRPART);
-				close (fd);
+					close (fd);
+				}
 			}
 			break;
 


More information about the hal-commit mailing list