File iprutils-close.diff of Package iprutils

Index: iprutils/iprdump.c
===================================================================
--- iprutils.orig/iprdump.c
+++ iprutils/iprdump.c
@@ -139,6 +139,7 @@ static void disable_dump(struct ipr_ioa
 		return;
 	}
 
+	close(fd);
 	sysfs_close_class_device(class_device);
 }
 
Index: iprutils/iprlib.c
===================================================================
--- iprutils.orig/iprlib.c
+++ iprutils/iprlib.c
@@ -7387,15 +7387,16 @@ int ipr_update_ioa_fw(struct ipr_ioa *io
 		tmp = strrchr(image->file, '/');
 		tmp++;
 		dir = opendir(hotplug_dir);
-		if (!dir)
+		if (!dir) {
 			mkdir(hotplug_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
 
-		dir = opendir(hotplug_dir);
-		if (!dir) {
-			syslog(LOG_ERR, "Failed to open %s. %m\n", hotplug_dir);
-			munmap(image_hdr, ucode_stats.st_size);
-			close(fd);
-			return -EIO;
+			dir = opendir(hotplug_dir);
+			if (!dir) {
+			    syslog(LOG_ERR, "Failed to open %s. %m\n", hotplug_dir);
+			    munmap(image_hdr, ucode_stats.st_size);
+			    close(fd);
+			    return -EIO;
+		    }
 		}
 		closedir(dir);
 		sprintf(ucode_file, "%s/.%s", hotplug_dir, tmp);