aboutsummaryrefslogtreecommitdiff
path: root/sysutils/brasero/files/patch-libbrasero-media_scsi-cam.c
blob: e342112f8562e4d7ed8e3005539c82c03aeb86cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- libbrasero-media/scsi-cam.c.orig	2009-09-25 10:39:03.000000000 -0400
+++ libbrasero-media/scsi-cam.c	2009-10-10 13:30:06.000000000 -0400
@@ -184,6 +184,8 @@ brasero_device_handle_open (const gchar 
 		handle->fd = fd;
 	}
 	else {
+		int serrno;
+
 		if (code) {
 			if (errno == EAGAIN
 			||  errno == EWOULDBLOCK
@@ -193,6 +195,15 @@ brasero_device_handle_open (const gchar 
 				*code = BRASERO_SCSI_ERRNO;
 		}
 
+		serrno = errno;
+
+		if (fd > -1)
+			close (fd);
+		if (cam)
+			cam_close_device (cam);
+
+		errno = serrno;
+
 		return NULL;
 	}