blob: 8c818e1bd8acd4408a3f35612b523e519ab858ed (
plain)
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
50
51
52
53
54
55
56
|
* local directory is at mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
* comparing to mbp@sourcefrog.net--2004/distcc--devel--2--patch-183
M ./src/tempfile.c
* modified files
--- orig/src/tempfile.c
+++ mod/src/tempfile.c
@@ -145,7 +145,7 @@
int dcc_get_top_dir(char **path_ret)
{
char *env;
- static char *cached;
+ static char *cached = NULL;
int ret;
if (cached) {
@@ -154,22 +154,23 @@
}
if ((env = getenv("DISTCC_DIR"))) {
- if ((cached = strdup(env)) == NULL) {
+
+ if ((cached = strdup(env)) == NULL)
return EXIT_OUT_OF_MEMORY;
- } else {
+ else
*path_ret = cached;
- return 0;
- }
- }
- if ((env = getenv("HOME")) == NULL) {
- rs_log_warning("HOME is not set; can't find distcc directory");
- return EXIT_BAD_ARGUMENTS;
- }
+ } else {
- if (asprintf(path_ret, "%s/.distcc", env) == -1) {
- rs_log_error("asprintf failed");
- return EXIT_OUT_OF_MEMORY;
+ if ((env = getenv("HOME")) == NULL) {
+ rs_log_warning("HOME is not set; can't find distcc directory");
+ return EXIT_BAD_ARGUMENTS;
+ }
+
+ if (asprintf(path_ret, "%s/.distcc", env) == -1) {
+ rs_log_error("asprintf failed");
+ return EXIT_OUT_OF_MEMORY;
+ }
}
ret = dcc_mkdir(*path_ret);
|