Ubuntu Pastebin

Paste from james at Fri, 24 Apr 2015 10:49:53 +0000

Download as text
 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
=== modified file 'init/log.c'
--- init/log.c	2014-07-07 16:39:49 +0000
+++ init/log.c	2015-04-24 10:49:11 +0000
@@ -42,7 +42,7 @@
  *
  * TRUE if log_clear_unflushed() has been called successfully.
  **/
-static int log_flushed = 0;
+int log_flushed = 0;
 
 /**
  * log_unflushed_files:
@@ -758,23 +758,23 @@
 
 	log_unflushed_init ();
 
-	/* re-parent */
-	nih_ref (log, log_unflushed_files);
-	nih_unref (log, parent);
-
-	elem = nih_list_entry_new (log);
+	elem = nih_list_entry_new (log_unflushed_files);
 	if (! elem) {
 		/* If memory is low, we discard the unflushed
 		 * data buffer too.
 		 */
-		nih_unref (log, log_unflushed_files);
+		nih_unref (log, parent);
 		return -1;
 	}
 
+	/* re-parent */
+	nih_ref (log, elem);
+	nih_unref (log, parent);
+
 	/* Indicate separation from parent */
 	log->detached = 1;
 
-	elem->data = log;    
+	elem->data = log;
 	nih_list_add_after (log_unflushed_files, &elem->entry);
 
 	return 0;
@@ -800,6 +800,8 @@
 		elem = (NihListEntry *)iter;
 		log = elem->data;
 
+		nih_assert (log);
+
 		/* To be added to this list, log should have been
 		 * detached from its parent job.
 		 */
@@ -833,7 +835,7 @@
 			return -1;
 
 		/* This will handle any remaining unflushed log data */
-		nih_free (log);
+		nih_free (elem);
 	}
 
 	log_flushed = 1;
Download as text