Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/CCache/debian/patches/01_no_home.diff @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1867:eb580660bbbb | 1899:b3009adc0e2f |
---|---|
1 --- ccache.c | |
2 +++ ccache.c | |
3 @@ -836,6 +836,13 @@ | |
4 { | |
5 /* find the real compiler */ | |
6 find_compiler(argc, argv); | |
7 + | |
8 + /* use the real compiler if HOME is not set */ | |
9 + if (!cache_dir) { | |
10 + cc_log("Unable to determine home directory\n"); | |
11 + cc_log("ccache is disabled\n"); | |
12 + failed(); | |
13 + } | |
14 | |
15 /* we might be disabled */ | |
16 if (getenv("CCACHE_DISABLE")) { | |
17 @@ -895,6 +902,13 @@ | |
18 printf("-V print version number\n"); | |
19 } | |
20 | |
21 +static void check_cache_dir(void) | |
22 +{ | |
23 + if (!cache_dir) { | |
24 + fatal("Unable to determine home directory"); | |
25 + } | |
26 +} | |
27 + | |
28 /* the main program when not doing a compile */ | |
29 static int ccache_main(int argc, char *argv[]) | |
30 { | |
31 @@ -914,31 +928,37 @@ | |
32 exit(0); | |
33 | |
34 case 's': | |
35 + check_cache_dir(); | |
36 stats_summary(); | |
37 break; | |
38 | |
39 case 'c': | |
40 + check_cache_dir(); | |
41 cleanup_all(cache_dir); | |
42 printf("Cleaned cache\n"); | |
43 break; | |
44 | |
45 case 'C': | |
46 + check_cache_dir(); | |
47 wipe_all(cache_dir); | |
48 printf("Cleared cache\n"); | |
49 break; | |
50 | |
51 case 'z': | |
52 + check_cache_dir(); | |
53 stats_zero(); | |
54 printf("Statistics cleared\n"); | |
55 break; | |
56 | |
57 case 'F': | |
58 + check_cache_dir(); | |
59 v = atoi(optarg); | |
60 stats_set_limits(v, -1); | |
61 printf("Set cache file limit to %u\n", (unsigned)v); | |
62 break; | |
63 | |
64 case 'M': | |
65 + check_cache_dir(); | |
66 v = value_units(optarg); | |
67 stats_set_limits(-1, v); | |
68 printf("Set cache size limit to %uk\n", (unsigned)v); | |
69 @@ -983,7 +1003,10 @@ | |
70 | |
71 cache_dir = getenv("CCACHE_DIR"); | |
72 if (!cache_dir) { | |
73 - x_asprintf(&cache_dir, "%s/.ccache", get_home_directory()); | |
74 + const char *home_directory = get_home_directory(); | |
75 + if (home_directory) { | |
76 + x_asprintf(&cache_dir, "%s/.ccache", home_directory); | |
77 + } | |
78 } | |
79 | |
80 temp_dir = getenv("CCACHE_TEMPDIR"); | |
81 @@ -1023,7 +1046,7 @@ | |
82 } | |
83 | |
84 /* make sure the cache dir exists */ | |
85 - if (create_dir(cache_dir) != 0) { | |
86 + if (cache_dir && (create_dir(cache_dir) != 0)) { | |
87 fprintf(stderr,"ccache: failed to create %s (%s)\n", | |
88 cache_dir, strerror(errno)); | |
89 exit(1); | |
90 --- util.c | |
91 +++ util.c | |
92 @@ -448,7 +448,7 @@ | |
93 } | |
94 } | |
95 #endif | |
96 - fatal("Unable to determine home directory"); | |
97 + cc_log("Unable to determine home directory"); | |
98 return NULL; | |
99 } | |
100 |