~ci-train-bot/lightdm/lightdm-ubuntu-zesty-1679

« back to all changes in this revision

Viewing changes to src/session.c

  • Committer: Alexandros Frantzis
  • Date: 2015-10-20 07:50:44 UTC
  • mto: This revision was merged to the branch mainline in revision 2226.
  • Revision ID: alexandros.frantzis@canonical.com-20151020075044-z7j5yga34lz16t29
Use logrotate to handle files in the default log directory

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;
198
199
}
199
200
 
200
201
void
201
 
session_set_log_file (Session *session, const gchar *filename)
 
202
session_set_log_file (Session *session, const gchar *filename, LogMode log_mode)
202
203
{
203
204
    g_return_if_fail (session != NULL);
204
205
    g_free (session->priv->log_filename);
205
206
    session->priv->log_filename = g_strdup (filename);
 
207
    session->priv->log_mode = log_mode;
206
208
}
207
209
 
208
210
void
619
621
    close (from_child_input);
620
622
 
621
623
    /* Indicate what version of the protocol we are using */
622
 
    version = 2;
 
624
    version = 3;
623
625
    write_data (session, &version, sizeof (version));
624
626
 
625
627
    /* Send configuration */
791
793
    if (session->priv->log_filename)
792
794
        l_debug (session, "Logging to %s", session->priv->log_filename);
793
795
    write_string (session, session->priv->log_filename);
 
796
    write_data (session, &session->priv->log_mode, sizeof (session->priv->log_mode));
794
797
    write_string (session, session->priv->tty);
795
798
    write_string (session, x_authority_filename);
796
799
    g_free (x_authority_filename);
857
860
    if (session_get_is_authenticated (session) && !session->priv->command_run)
858
861
    {
859
862
        gsize n = 0;
 
863
        LogMode log_mode = LOG_MODE_INVALID;
860
864
 
861
865
        session->priv->command_run = TRUE;
862
866
        write_string (session, NULL); // log filename
 
867
        write_data (session, &log_mode, sizeof (log_mode)); // log mode
863
868
        write_string (session, NULL); // tty
864
869
        write_string (session, NULL); // xauth filename
865
870
        write_string (session, NULL); // xdisplay
903
908
{
904
909
    session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, SESSION_TYPE, SessionPrivate);
905
910
    session->priv->log_filename = g_strdup (".xsession-errors");
 
911
    session->priv->log_mode = LOG_MODE_BACKUP_AND_TRUNCATE;
906
912
    session->priv->to_child_input = -1;
907
913
    session->priv->from_child_output = -1;
908
914
}