~ubuntu-branches/debian/wheezy/brasero/wheezy

« back to all changes in this revision

Viewing changes to debian/patches/030_fd_leak.patch

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Henriksson
  • Date: 2009-10-27 14:03:16 UTC
  • mfrom: (1.2.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20091027140316-q8g6v1678zwg6748
Tags: 2.28.2-1
* New upstream bugfix release.
  - Upstream patch 030_fd_leak.patch dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 3af0a55b9c9888d68054c851e14861acfdb51453 Mon Sep 17 00:00:00 2001
2
 
From: Philippe Rouquier <bonfire-app@wanadoo.fr>
3
 
Date: Sat, 26 Sep 2009 12:49:40 +0000
4
 
Subject: Don't leak file descriptors
5
 
 
6
 
This could be the reason why media did not get ejected
7
 
---
8
 
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
9
 
index 08ab4e7..f3a7136 100644
10
 
--- a/libbrasero-media/brasero-drive.c
11
 
+++ b/libbrasero-media/brasero-drive.c
12
 
@@ -810,7 +810,7 @@ brasero_drive_probe_inside_thread (gpointer data)
13
 
        const gchar *device;
14
 
        BraseroScsiErrCode code;
15
 
        BraseroDrivePrivate *priv;
16
 
-       BraseroDeviceHandle *handle;
17
 
+       BraseroDeviceHandle *handle = NULL;
18
 
        BraseroDrive *drive = BRASERO_DRIVE (data);
19
 
 
20
 
        priv = BRASERO_DRIVE_PRIVATE (drive);
21
 
@@ -833,13 +833,15 @@ brasero_drive_probe_inside_thread (gpointer data)
22
 
                handle = brasero_device_handle_open (device, FALSE, &code);
23
 
        }
24
 
 
25
 
-       if (priv->probe_cancelled) {
26
 
-               BRASERO_MEDIA_LOG ("Open () cancelled");
27
 
+       if (!handle) {
28
 
+               BRASERO_MEDIA_LOG ("Open () failed: medium busy");
29
 
                goto end;
30
 
        }
31
 
 
32
 
-       if (!handle) {
33
 
-               BRASERO_MEDIA_LOG ("Open () failed: medium busy");
34
 
+       if (priv->probe_cancelled) {
35
 
+               BRASERO_MEDIA_LOG ("Open () cancelled");
36
 
+
37
 
+               brasero_device_handle_close (handle);
38
 
                goto end;
39
 
        }
40
 
 
41
 
@@ -848,20 +850,24 @@ brasero_drive_probe_inside_thread (gpointer data)
42
 
                        BRASERO_MEDIA_LOG ("No medium inserted");
43
 
 
44
 
                        priv->has_medium = FALSE;
45
 
+
46
 
+                       brasero_device_handle_close (handle);
47
 
                        goto end;
48
 
                }
49
 
 
50
 
                if (code != BRASERO_SCSI_NOT_READY) {
51
 
-                       brasero_device_handle_close (handle);
52
 
                        BRASERO_MEDIA_LOG ("Device does not respond");
53
 
+
54
 
+                       brasero_device_handle_close (handle);
55
 
                        goto end;
56
 
                }
57
 
 
58
 
                sleep (2);
59
 
 
60
 
                if (priv->probe_cancelled) {
61
 
-                       brasero_device_handle_close (handle);
62
 
                        BRASERO_MEDIA_LOG ("Device probing cancelled");
63
 
+
64
 
+                       brasero_device_handle_close (handle);
65
 
                        goto end;
66
 
                }
67
 
        }
68
 
diff --git a/libbrasero-media/brasero-medium.c b/libbrasero-media/brasero-medium.c
69
 
index 46762d4..88a801d 100644
70
 
--- a/libbrasero-media/brasero-medium.c
71
 
+++ b/libbrasero-media/brasero-medium.c
72
 
@@ -2978,43 +2978,49 @@ brasero_medium_probe_thread (gpointer self)
73
 
                handle = brasero_device_handle_open (device, FALSE, &code);
74
 
        }
75
 
 
76
 
-       if (priv->probe_cancelled)
77
 
+       if (!handle) {
78
 
+               BRASERO_MEDIA_LOG ("Open () failed: medium busy");
79
 
                goto end;
80
 
+       }
81
 
 
82
 
-       if (handle) {
83
 
-               BRASERO_MEDIA_LOG ("Open () succeeded");
84
 
-
85
 
-               /* NOTE: if we wanted to know the status we'd need to read the 
86
 
-                * error code variable which is currently NULL */
87
 
-               while (brasero_spc1_test_unit_ready (handle, &code) != BRASERO_SCSI_OK) {
88
 
-                       if (code == BRASERO_SCSI_NO_MEDIUM) {
89
 
-                               brasero_device_handle_close (handle);
90
 
-                               BRASERO_MEDIA_LOG ("No medium inserted");
91
 
-                               priv->info = BRASERO_MEDIUM_NONE;
92
 
-                               goto end;
93
 
-                       }
94
 
-                       else if (code != BRASERO_SCSI_NOT_READY) {
95
 
-                               brasero_device_handle_close (handle);
96
 
-                               BRASERO_MEDIA_LOG ("Device does not respond");
97
 
-                               goto end;
98
 
-                       }
99
 
+       if (priv->probe_cancelled) {
100
 
+               brasero_device_handle_close (handle);
101
 
+               goto end;
102
 
+       }
103
 
 
104
 
-                       sleep (2);
105
 
+       BRASERO_MEDIA_LOG ("Open () succeeded");
106
 
 
107
 
-                       if (priv->probe_cancelled) {
108
 
-                               brasero_device_handle_close (handle);
109
 
-                               BRASERO_MEDIA_LOG ("Device probing cancelled");
110
 
-                               goto end;
111
 
-                       }
112
 
+       /* NOTE: if we wanted to know the status we'd need to read the 
113
 
+        * error code variable which is currently NULL */
114
 
+       while (brasero_spc1_test_unit_ready (handle, &code) != BRASERO_SCSI_OK) {
115
 
+               if (code == BRASERO_SCSI_NO_MEDIUM) {
116
 
+                       BRASERO_MEDIA_LOG ("No medium inserted");
117
 
+                       priv->info = BRASERO_MEDIUM_NONE;
118
 
+
119
 
+                       brasero_device_handle_close (handle);
120
 
+                       goto end;
121
 
                }
122
 
+               else if (code != BRASERO_SCSI_NOT_READY) {
123
 
+                       BRASERO_MEDIA_LOG ("Device does not respond");
124
 
 
125
 
-               BRASERO_MEDIA_LOG ("Device ready");
126
 
+                       brasero_device_handle_close (handle);
127
 
+                       goto end;
128
 
+               }
129
 
 
130
 
-               brasero_medium_init_real (BRASERO_MEDIUM (self), handle);
131
 
-               brasero_device_handle_close (handle);
132
 
+               sleep (2);
133
 
+
134
 
+               if (priv->probe_cancelled) {
135
 
+                       BRASERO_MEDIA_LOG ("Device probing cancelled");
136
 
+
137
 
+                       brasero_device_handle_close (handle);
138
 
+                       goto end;
139
 
+               }
140
 
        }
141
 
-       else
142
 
-               BRASERO_MEDIA_LOG ("Open () failed: medium busy");
143
 
+
144
 
+       BRASERO_MEDIA_LOG ("Device ready");
145
 
+
146
 
+       brasero_medium_init_real (BRASERO_MEDIUM (self), handle);
147
 
+       brasero_device_handle_close (handle);
148
 
 
149
 
 end:
150
 
 
151
 
--
152
 
cgit v0.8.2