]> 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.

common/configuration.c
debian/patches/04_language_handling.patch
debian/patches/autologin-session-workaround.patch
debian/patches/series
debian/patches/xorg-1.17.patch [deleted file]
src/log-file.h
src/seat.c

index dc7831a83dff76e05b3f4ac44dc55abdccd57a52..e7bee3097c5d09e1a2b37a6e1d8f8993f391fd3e 100644 (file)
@@ -317,7 +317,22 @@ config_set_boolean (Configuration *config, const gchar *section, const gchar *ke
 gboolean
 config_get_boolean (Configuration *config, const gchar *section, const gchar *key)
 {
-    return g_key_file_get_boolean (config->priv->key_file, section, key, NULL);
+    /* We don't use the standard function because it doesn't work with trailing whitespace:
+     * https://bugzilla.gnome.org/show_bug.cgi?id=664740
+     */
+    /*return g_key_file_get_boolean (config->priv->key_file, section, key, NULL);*/
+
+    gchar *value;
+    gboolean v;
+
+    value = g_key_file_get_value (config->priv->key_file, section, key, NULL);
+    if (!value)
+        return FALSE;
+    g_strchomp (value);
+    v = strcmp (value, "true") == 0;
+    g_free (value);
+
+    return v;
 }
 
 static void
index 09d56244f420d7b9e55dc857dd73aa457e8330da..f25923ef1cb3e26cef90dcab75437c038f2b86aa 100644 (file)
@@ -75,7 +75,7 @@ Index: trunk/src/seat.c
 ===================================================================
 --- trunk.orig/src/seat.c
 +++ trunk/src/seat.c
-@@ -1003,7 +1003,7 @@ configure_session (Session *session, Ses
+@@ -1018,7 +1018,7 @@ configure_session (Session *session, Ses
      }
      if (language && language[0] != '\0')
      {
index 1d977d7b69109b039d610833941810172714a1b8..fb46d817b2bfcb01f5339db91e5c4cc564a938f0 100644 (file)
@@ -6,7 +6,7 @@ Index: trunk/src/seat.c
 ===================================================================
 --- trunk.orig/src/seat.c
 +++ trunk/src/seat.c
-@@ -1033,7 +1033,12 @@ create_user_session (Seat *seat, const g
+@@ -1048,7 +1048,12 @@ create_user_session (Seat *seat, const g
      if (autostart)
      {
          const gchar *autologin_session_name = seat_get_string_property (seat, "autologin-session");
index 7f14c0ad7b1f3876637262c0911958e2b663ddaa..d3ba2550a2c08550df7ba0b12a73746f218837a5 100644 (file)
@@ -1,4 +1,3 @@
 04_language_handling.patch
 05_translate_debian_files.patch
 autologin-session-workaround.patch
-xorg-1.17.patch
diff --git a/debian/patches/xorg-1.17.patch b/debian/patches/xorg-1.17.patch
deleted file mode 100644 (file)
index 9f7ecfd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Description: The X.org X server 1.17 doesn't listen on TCP by default, we need to pass -listen to enable it
-Author: Robert Ancell <robert.ancell@canonical.com>
-Bug: https://bugs.launchpad.net/bugs/1449282
-
-=== modified file 'src/x-server-local.c'
-Index: 1.16/src/x-server-local.c
-===================================================================
---- 1.16.orig/src/x-server-local.c
-+++ 1.16/src/x-server-local.c
-@@ -477,6 +477,7 @@ x_server_local_start (DisplayServer *dis
-     /* Connect to a remote server using XDMCP */
-     if (server->priv->xdmcp_server != NULL)
-     {
-+        g_string_append (command, " -listen tcp");
-         if (server->priv->xdmcp_port != 0)
-             g_string_append_printf (command, " -port %d", server->priv->xdmcp_port);
-         g_string_append_printf (command, " -query %s", server->priv->xdmcp_server);
-@@ -485,6 +486,8 @@ x_server_local_start (DisplayServer *dis
-     }
-     else if (!server->priv->allow_tcp)
-         g_string_append (command, " -nolisten tcp");
-+    else
-+        g_string_append (command, " -listen tcp");
-     if (server->priv->vt >= 0)
-         g_string_append_printf (command, " vt%d -novtswitch", server->priv->vt);
index 11d1151baa232f73a604e00ddccc3b94507b0f6e..bfaee29fb0aa639d8715b20f58458e8b2290ff10 100644 (file)
@@ -18,4 +18,4 @@
 
 int log_file_open (const gchar *log_filename, LogMode log_mode);
 
-#endif /* !LOG_FILE_H */
+#endif /* LOG_FILE_H_ */
index 9d00e01d2638ab6f2ac8d0cfafbb69da29196715..6d0a6ced5141f92fff753145e16829434688bc9d 100644 (file)
@@ -147,7 +147,19 @@ seat_get_string_list_property (Seat *seat, const gchar *name)
 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