summaryrefslogtreecommitdiffstats
path: root/src/lib/globals
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2014-05-27 12:05:12 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2014-06-17 12:59:41 +0200
commit105fba4593f02fccb85909ea3bc30ed8c426908d (patch)
treee3c6358a30dd68bd798f8b84571ab8a6f00526f5 /src/lib/globals
parent223942f36b1a071bcca39d1e0adb615f9440db1f (diff)
downloadnetctl-105fba4593f02fccb85909ea3bc30ed8c426908d.tar.gz
netctl-105fba4593f02fccb85909ea3bc30ed8c426908d.tar.xz
Escape hatch for the restrictive umask
Some things should not be run with the restrictive umask. This provides a means to do so: do_readable.
Diffstat (limited to 'src/lib/globals')
-rw-r--r--src/lib/globals16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/globals b/src/lib/globals
index cf99575..42ac177 100644
--- a/src/lib/globals
+++ b/src/lib/globals
@@ -4,8 +4,6 @@ SUBR_DIR="/usr/lib/network"
STATE_DIR="/run/network"
STATE_FILE="${NETCTL_STATE_FILE:-/var/lib/netctl/netctl.state}"
-umask 077
-
### Logging/Error reporting
@@ -72,6 +70,16 @@ do_debug() {
"$@"
}
+## Evaluate with a permissive umask
+do_readable() {
+ local result
+ umask 022
+ "$@"
+ result=$?
+ umask 077
+ return $result
+}
+
## Exit if we are not effectively root
# $1: program name (optional)
ensure_root() {
@@ -126,4 +134,8 @@ load_profile() {
}
+# Set a restrictive umask
+do_readable :
+
+
# vim: ft=sh ts=4 et sw=4: