Annotation of /trunk/consolekit/patches/consolekit-0.4.1-cleanup-console-tags.patch
Parent Directory | Revision Log
Revision 930 -
(hide annotations)
(download)
Sun Nov 8 03:47:35 2009 UTC (14 years, 10 months ago) by niro
File size: 1680 byte(s)
Sun Nov 8 03:47:35 2009 UTC (14 years, 10 months ago) by niro
File size: 1680 byte(s)
-files and fixes for consolekit-0.4.1-r1
1 | niro | 930 | # http://patches.ubuntu.com/by-release/extracted/ubuntu/c/consolekit/0.2.10-1ubuntu9/ |
2 | --- a/src/main.c 2008-07-25 03:19:34.000000000 +0200 | ||
3 | +++ b/src/main.c 2008-07-26 00:25:13.000000000 +0200 | ||
4 | @@ -149,6 +149,43 @@ | ||
5 | unlink (CONSOLE_KIT_PID_FILE); | ||
6 | } | ||
7 | |||
8 | +#define CONSOLE_TAGS_DIR "/var/run/console" | ||
9 | + | ||
10 | +static void | ||
11 | +delete_console_tags (void) | ||
12 | +{ | ||
13 | + GDir *dir; | ||
14 | + GError *error = NULL; | ||
15 | + const gchar *name; | ||
16 | + | ||
17 | + g_debug ("Cleaning up %s", CONSOLE_TAGS_DIR); | ||
18 | + | ||
19 | + dir = g_dir_open (CONSOLE_TAGS_DIR, 0, &error); | ||
20 | + if (dir == NULL) { | ||
21 | + g_debug ("Couldn't open directory %s: %s", CONSOLE_TAGS_DIR, | ||
22 | + error->message); | ||
23 | + g_error_free (error); | ||
24 | + return; | ||
25 | + } | ||
26 | + while ((name = g_dir_read_name (dir)) != NULL) { | ||
27 | + gchar *file; | ||
28 | + file = g_build_filename (CONSOLE_TAGS_DIR, name, NULL); | ||
29 | + | ||
30 | + g_debug ("Removing tag file: %s", file); | ||
31 | + if (unlink (file) == -1) { | ||
32 | + g_warning ("Couldn't delete tag file: %s", file); | ||
33 | + } | ||
34 | + g_free (file); | ||
35 | + } | ||
36 | +} | ||
37 | + | ||
38 | +static void | ||
39 | +cleanup (void) | ||
40 | +{ | ||
41 | + delete_console_tags (); | ||
42 | + delete_pid (); | ||
43 | +} | ||
44 | + | ||
45 | /* copied from nautilus */ | ||
46 | static int debug_log_pipes[2]; | ||
47 | |||
48 | @@ -229,7 +266,7 @@ | ||
49 | snprintf (pid, sizeof (pid), "%lu\n", (long unsigned) getpid ()); | ||
50 | written = write (pf, pid, strlen (pid)); | ||
51 | close (pf); | ||
52 | - g_atexit (delete_pid); | ||
53 | + g_atexit (cleanup); | ||
54 | } else { | ||
55 | g_warning ("Unable to write pid file %s: %s", | ||
56 | CONSOLE_KIT_PID_FILE, | ||
57 | @@ -312,6 +349,8 @@ | ||
58 | |||
59 | g_debug ("initializing console-kit-daemon %s", VERSION); | ||
60 | |||
61 | + delete_console_tags (); | ||
62 | + | ||
63 | create_pid_file (); | ||
64 | |||
65 | manager = ck_manager_new (); |