summaryrefslogtreecommitdiff
path: root/debian/patches/exec_fix.patch
blob: 2d53678abc46effc62eb334e6ad8d43fe520d60b (plain)
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
28
29
Fixes long-standing random hang of exec.

2009-05-25  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* exec.c (finish): Set FILE_DATA and MAP_BUFFER members of E to NULL
	after freeing them.

---
 exec/exec.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1008,10 +1008,13 @@ finish (struct execdata *e, int dealloc_
 #ifdef EXECDATA_STREAM
       fclose (&e->stream);
 #else
-      if (e->file_data != NULL)
+      if (e->file_data != NULL) {
 	free (e->file_data);
-      else if (map_buffer (e) != NULL)
+	e->file_data = NULL;
+      } else if (map_buffer (e) != NULL) {
 	munmap (map_buffer (e), map_vsize (e));
+	map_buffer (e) = NULL;
+      }
 #endif
     }
   if (dealloc_file && e->file != MACH_PORT_NULL)