~lightdm-team/lightdm/1.14

« back to all changes in this revision

Viewing changes to src/session.c

  • Committer: Robert Ancell
  • Date: 2015-10-28 03:28:13 UTC
  • Revision ID: robert.ancell@canonical.com-20151028032813-yh3hnigb4b41e4bg
Add a backup-logs option that can be used to disable existing logging files having a .old suffix added to them

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
 
85
85
    /* File to log to */
86
86
    gchar *log_filename;
 
87
    LogMode log_mode;
87
88
 
88
89
    /* tty this session is running on */
89
90
    gchar *tty;
199
200
}
200
201
 
201
202
void
202
 
session_set_log_file (Session *session, const gchar *filename)
 
203
session_set_log_file (Session *session, const gchar *filename, LogMode log_mode)
203
204
{
204
205
    g_return_if_fail (session != NULL);
205
206
    g_free (session->priv->log_filename);
206
207
    session->priv->log_filename = g_strdup (filename);
 
208
    session->priv->log_mode = log_mode;
207
209
}
208
210
 
209
211
void
626
628
    close (from_child_input);
627
629
 
628
630
    /* Indicate what version of the protocol we are using */
629
 
    version = 2;
 
631
    version = 3;
630
632
    write_data (session, &version, sizeof (version));
631
633
 
632
634
    /* Send configuration */
798
800
    if (session->priv->log_filename)
799
801
        l_debug (session, "Logging to %s", session->priv->log_filename);
800
802
    write_string (session, session->priv->log_filename);
 
803
    write_data (session, &session->priv->log_mode, sizeof (session->priv->log_mode));
801
804
    write_string (session, session->priv->tty);
802
805
    write_string (session, x_authority_filename);
803
806
    g_free (x_authority_filename);
864
867
    if (session_get_is_authenticated (session) && !session->priv->command_run)
865
868
    {
866
869
        gsize n = 0;
 
870
        LogMode log_mode = LOG_MODE_INVALID;
867
871
 
868
872
        session->priv->command_run = TRUE;
869
873
        write_string (session, NULL); // log filename
 
874
        write_data (session, &log_mode, sizeof (log_mode)); // log mode
870
875
        write_string (session, NULL); // tty
871
876
        write_string (session, NULL); // xauth filename
872
877
        write_string (session, NULL); // xdisplay
910
915
{
911
916
    session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, SESSION_TYPE, SessionPrivate);
912
917
    session->priv->log_filename = g_strdup (".xsession-errors");
 
918
    session->priv->log_mode = LOG_MODE_BACKUP_AND_TRUNCATE;
913
919
    session->priv->to_child_input = -1;
914
920
    session->priv->from_child_output = -1;
915
921
}