]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
config: Use umask from conf struct
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Jul 2011 21:25:31 +0000 (23:25 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 20 Jul 2011 21:31:37 +0000 (23:31 +0200)
ccache.c
conf.c
system.h
test/test_conf.c

index 8f23a502c6fab0f41957c689b2820334e19546fd..1a6009c6bef03b151da25459d41c1aef0d8aa6f3 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1816,15 +1816,8 @@ initialize(void)
 
        cc_log("=== CCACHE STARTED =========================================");
 
-       /* the user might have set CCACHE_UMASK */
-       p = getenv("CCACHE_UMASK");
-       if (p) {
-               mode_t mask;
-               errno = 0;
-               mask = strtol(p, NULL, 8);
-               if (errno == 0) {
-                       umask(mask);
-               }
+       if (conf->umask != UINT_MAX) {
+               umask(conf->umask);
        }
 
        current_working_dir = get_cwd();
diff --git a/conf.c b/conf.c
index 0fdab63db82085a57f4d9722a3ad469ff7a18986..abe8cbc81440ecc98b6bb6a3d86c98bc5f26b004 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -437,7 +437,7 @@ conf_create(void)
        conf->sloppiness = 0;
        conf->stats = true;
        conf->temporary_dir = x_strdup("");
-       conf->umask = 0;
+       conf->umask = UINT_MAX; /* default: don't set umask */
        conf->unify = false;
        return conf;
 }
index a75025f71e10ab4a883ca6ec464b6cb72f7b0686..eca78a68b59ca126f36155a5d9db760c77db6582 100644 (file)
--- a/system.h
+++ b/system.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Joel Rosdahl
+ * Copyright (C) 2010-2011 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -37,6 +37,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
index e687687d280516350254ef8b308a946619ffa1ee..5485848317c111f9a049a75f69c39a4f83dadeaa 100644 (file)
@@ -62,7 +62,7 @@ TEST(conf_create)
        CHECK_UNS_EQ(0, conf->sloppiness);
        CHECK(conf->stats);
        CHECK_STR_EQ("", conf->temporary_dir);
-       CHECK_UNS_EQ(0, conf->umask);
+       CHECK_UNS_EQ(UINT_MAX, conf->umask);
        CHECK(!conf->unify);
        conf_free(conf);
 }