From: Joel Rosdahl Date: Sat, 16 Jul 2011 21:25:31 +0000 (+0200) Subject: config: Use umask from conf struct X-Git-Tag: v3.2~212 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd6390b127dd61e224566be7c06132ffd3eedb25;p=thirdparty%2Fccache.git config: Use umask from conf struct --- diff --git a/ccache.c b/ccache.c index 8f23a502c..1a6009c6b 100644 --- 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 0fdab63db..abe8cbc81 100644 --- 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; } diff --git a/system.h b/system.h index a75025f71..eca78a68b 100644 --- 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 #include #include +#include #include #include #include diff --git a/test/test_conf.c b/test/test_conf.c index e687687d2..548584831 100644 --- a/test/test_conf.c +++ b/test/test_conf.c @@ -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); }