aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangnaru0605 <67086371+zhangnaru0605@users.noreply.github.com>2020-07-14 21:43:15 +0800
committerGitHub <noreply@github.com>2020-07-14 15:43:15 +0200
commit905497da1838e5d7b35d6a0daf6c241c47d59323 (patch)
tree2bc2b0a8c7bfea08e3b9931819fe9ef2a51963ef
parentff4fcd53fae5189b6a4692647463823ea7d1c16c (diff)
downloadinitscripts-905497da1838e5d7b35d6a0daf6c241c47d59323.tar
initscripts-905497da1838e5d7b35d6a0daf6c241c47d59323.tar.gz
initscripts-905497da1838e5d7b35d6a0daf6c241c47d59323.tar.bz2
initscripts-905497da1838e5d7b35d6a0daf6c241c47d59323.tar.xz
initscripts-905497da1838e5d7b35d6a0daf6c241c47d59323.zip
Maintain permisision to set umask
set umask in case resolv.conf doesn't exist
-rw-r--r--network-scripts/network-functions3
1 files changed, 3 insertions, 0 deletions
diff --git a/network-scripts/network-functions b/network-scripts/network-functions
index 99096bd8..332115b8 100644
--- a/network-scripts/network-functions
+++ b/network-scripts/network-functions
@@ -622,6 +622,8 @@ is_bonding_device ()
# Invoke this when /etc/resolv.conf has changed:
change_resolv_conf ()
{
+ oldumask=$(umask)
+ umask 022
s=$(/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null)
if [ $# -gt 1 ]; then
if [ "x$s" != "x" ]; then
@@ -657,6 +659,7 @@ change_resolv_conf ()
/usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf"
[ -e /run/nscd/socket ] && /usr/sbin/nscd -i hosts # invalidate cache
fi
+ umask "$oldumask"
return $r
}