Save the initial working directory and change to it just before running
authorRoy Marples <roy@marples.name>
Fri, 22 Jan 2016 10:30:21 +0000 (10:30 +0000)
committerRoy Marples <roy@marples.name>
Fri, 22 Jan 2016 10:30:21 +0000 (10:30 +0000)
any scripts.
This avoids scripts putting files accidently where they shouldn't.

resolvconf.in

index a946ed8c44b5cfa9f95dd6ad654d476dca069e7d..69e6df9150563b3b722f9e31e6d29654f4d95809 100644 (file)
@@ -55,6 +55,7 @@ METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"
 EXCLUSIVEDIR="$VARDIR/exclusive"
 LOCKDIR="$VARDIR/lock"
 PRIVATEDIR="$VARDIR/private"
 EXCLUSIVEDIR="$VARDIR/exclusive"
 LOCKDIR="$VARDIR/lock"
+_PWD="$PWD"
 
 warn()
 {
 
 warn()
 {
@@ -752,6 +753,10 @@ eval "$(make_vars)"
 export RESOLVCONF DOMAINS SEARCH NAMESERVERS LOCALNAMESERVERS
 : ${list_resolv:=list_resolv -l}
 retval=0
 export RESOLVCONF DOMAINS SEARCH NAMESERVERS LOCALNAMESERVERS
 : ${list_resolv:=list_resolv -l}
 retval=0
+
+# Run scripts in the same directory resolvconf is run from
+# in case any scripts accidently dump files in the wrong place.
+cd "$_PWD"
 for script in "$LIBEXECDIR"/*; do
        if [ -f "$script" ]; then
                eval script_enabled="\$${script##*/}"
 for script in "$LIBEXECDIR"/*; do
        if [ -f "$script" ]; then
                eval script_enabled="\$${script##*/}"