File: make-inability-to-create-config-dir-non-fatal.patch

package info (click to toggle)
cpdb-libs 2.0~b5-1.2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 836 kB
  • sloc: ansic: 2,967; sh: 139; xml: 111; makefile: 103
file content (49 lines) | stat: -rw-r--r-- 1,257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Description: fix for Ubuntu package, might become available upstream
Forwarded: not-needed
--- a/cpdb/cpdb-frontend.c
+++ b/cpdb/cpdb-frontend.c
@@ -424,7 +424,7 @@
 {
     loginfo("Ignoring previous settings\n");
     cpdbDeleteSettings(f->last_saved_settings);
-    f->last_saved_settings = NULL;
+    f->last_saved_settings = cpdbGetNewSettings();
 }
 
 gboolean cpdbAddPrinter(cpdb_frontend_obj_t *f, 
@@ -1857,10 +1857,12 @@
     char buf[CPDB_BSIZE];
     cpdb_settings_t *s;
 
+    s = cpdbGetNewSettings();
+
     if ((conf_dir = cpdbGetUserConfDir()) == NULL)
     {
         logerror("No previous settings found : Couldn't obtain user config dir\n");
-        return NULL;
+        return s;
     }
     path = cpdbConcatPath(conf_dir, CPDB_PRINT_SETTINGS_FILE);
 
@@ -1871,10 +1873,9 @@
         free(path);
         free(conf_dir);
         
-        return NULL;
+        return s;
     }
 
-    s = cpdbGetNewSettings();
     if (fscanf(fp, "%d\n", &count) == 0)
     {
         logerror("Error getting settings from disk : Couldn't parse %s\n",
@@ -1882,8 +1883,7 @@
         fclose(fp);
         free(path);
         free(conf_dir);
-        cpdbDeleteSettings(s);
-        return NULL;
+        return s;
     }
     while (count--)
     {