~upstart-devel/upstart/trunk

« back to all changes in this revision

Viewing changes to init/log.c

  • Committer: Steve Langasek
  • Date: 2015-04-25 18:01:27 UTC
  • mfrom: (1664.1.1 upstart-bug-1447756)
  • Revision ID: steve.langasek@canonical.com-20150425180127-e1izc0mzx5idefwh
MergeĀ lp:~jamesodhunt/upstart/bug-1447756

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 *
43
43
 * TRUE if log_clear_unflushed() has been called successfully.
44
44
 **/
45
 
static int log_flushed = 0;
 
45
int log_flushed = 0;
46
46
 
47
47
/**
48
48
 * log_unflushed_files:
758
758
 
759
759
        log_unflushed_init ();
760
760
 
761
 
        /* re-parent */
762
 
        nih_ref (log, log_unflushed_files);
763
 
        nih_unref (log, parent);
764
 
 
765
 
        elem = nih_list_entry_new (log);
 
761
        elem = nih_list_entry_new (log_unflushed_files);
766
762
        if (! elem) {
767
763
                /* If memory is low, we discard the unflushed
768
764
                 * data buffer too.
769
765
                 */
770
 
                nih_unref (log, log_unflushed_files);
 
766
                nih_unref (log, parent);
771
767
                return -1;
772
768
        }
773
769
 
 
770
        /* re-parent */
 
771
        nih_ref (log, elem);
 
772
        nih_unref (log, parent);
 
773
 
774
774
        /* Indicate separation from parent */
775
775
        log->detached = 1;
776
776
 
777
 
        elem->data = log;    
 
777
        elem->data = log;
778
778
        nih_list_add_after (log_unflushed_files, &elem->entry);
779
779
 
780
780
        return 0;
800
800
                elem = (NihListEntry *)iter;
801
801
                log = elem->data;
802
802
 
 
803
                nih_assert (log);
 
804
 
803
805
                /* To be added to this list, log should have been
804
806
                 * detached from its parent job.
805
807
                 */
833
835
                        return -1;
834
836
 
835
837
                /* This will handle any remaining unflushed log data */
836
 
                nih_free (log);
 
838
                nih_free (elem);
837
839
        }
838
840
 
839
841
        log_flushed = 1;