]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Use logrotate to handle files in the default log directory.
authorRobert Ancell <robert.ancell@canonical.com>
Thu, 22 Oct 2015 03:07:32 +0000 (16:07 +1300)
committerRobert Ancell <robert.ancell@canonical.com>
Thu, 22 Oct 2015 03:07:32 +0000 (16:07 +1300)
This change introduces support for log rotation using the logrotate tool for
file in the default log directory (/var/log/lightdm). To support this
scenario, existing system log files are not moved to *.old when starting.

1  2 
src/log-file.h
src/seat.c

diff --combined src/log-file.h
index 0000000000000000000000000000000000000000,11d1151baa232f73a604e00ddccc3b94507b0f6e..bfaee29fb0aa639d8715b20f58458e8b2290ff10
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,21 +1,21 @@@
 -#endif /* !LOG_FILE_H */
+ /*
+  * Copyright (C) 2015 Alexandros Frantzis
+  * Author: Alexandros Frantzis <alexandros.frantzis@canonical.com>
+  *
+  * This program is free software: you can redistribute it and/or modify it under
+  * the terms of the GNU General Public License as published by the Free Software
+  * Foundation, either version 3 of the License, or (at your option) any later
+  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+  * license.
+  */
+ #ifndef LOG_FILE_H_
+ #define LOG_FILE_H_
+ #include <glib.h>
+ #include "log-mode.h"
+ int log_file_open (const gchar *log_filename, LogMode log_mode);
++#endif /* LOG_FILE_H_ */
diff --combined src/seat.c
index aff5d936471c2a81b9a8af70b58f99ac5f2c813d,9d00e01d2638ab6f2ac8d0cfafbb69da29196715..6d0a6ced5141f92fff753145e16829434688bc9d
@@@ -147,19 -147,7 +147,19 @@@ seat_get_string_list_property (Seat *se
  gboolean
  seat_get_boolean_property (Seat *seat, const gchar *name)
  {
 -    return g_strcmp0 (seat_get_string_property (seat, name), "true") == 0;
 +    const gchar *value;
 +    gint i, length = 0;
 +
 +    value = seat_get_string_property (seat, name);
 +    if (!value)
 +        return FALSE;
 +
 +    /* Count the number of non-whitespace characters */
 +    for (i = 0; value[i]; i++)
 +        if (!g_ascii_isspace (value[i]))
 +            length = i + 1;
 +
 +    return strncmp (value, "true", MAX (length, 4)) == 0;
  }
  
  gint
@@@ -614,7 -602,7 +614,7 @@@ start_session (Seat *seat, Session *ses
          log_filename = g_build_filename (log_dir, filename, NULL);
          g_free (log_dir);
          g_free (filename);
-         session_set_log_file (session, log_filename);
+         session_set_log_file (session, log_filename, LOG_MODE_APPEND);
          g_free (log_filename);
      }