Adding 17-follow-symlink.patch to follow symlink on config save (Closes: #810632).
[debian/lxdm.git] / debian / patches / 17-follow-symlink.patch
1 Description: follow symlink on configuration update, see bug #810632
2 Author: Julien Lavergne <gilir@ubuntu.com>
3 Bug: https://sourceforge.net/p/lxde/bugs/223/
4
5 --- a/src/lxdm.c
6 +++ b/src/lxdm.c
7 @@ -1262,7 +1262,14 @@
8          char* data = g_key_file_to_data(var, &len, NULL);
9                 mkdir("/var/lib/lxdm",0755);
10                 chmod("/var/lib/lxdm",0755);
11 -        g_file_set_contents(VCONFIG_FILE, data, len, NULL);
12 +               if( g_file_test(VCONFIG_FILE, G_FILE_TEST_IS_SYMLINK) )
13 +               {
14 +                       gchar* config_file = g_file_read_link(VCONFIG_FILE, NULL);
15 +                       g_file_set_contents(config_file, data, len, NULL);
16 +                       g_free(config_file);
17 +               }
18 +               else
19 +                       g_file_set_contents(VCONFIG_FILE, data, len, NULL);
20          g_free(data);
21         }
22         g_key_file_free(var);