From: Rob Browning Date: Sat, 18 Aug 2012 19:56:05 +0000 (-0500) Subject: Convert BUP_DIR to an absolute path so chdir() won't cause trouble. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=847f8b5d2037c80e2da40bae011cc847f660d8f3;p=packages%2Fb%2Fbup.git Convert BUP_DIR to an absolute path so chdir() won't cause trouble. Signed-off-by: Rob Browning Reviewed-by: Zoran Zaric --- diff --git a/main.py b/main.py index 67ad011..3554179 100755 --- a/main.py +++ b/main.py @@ -95,6 +95,10 @@ for opt in global_args: else: usage('error: unexpected option "%s"' % opt[0]) +# Make BUP_DIR absolute, so we aren't affected by chdir (i.e. save -C, etc.). +if 'BUP_DIR' in os.environ: + os.environ['BUP_DIR'] = os.path.abspath(os.environ['BUP_DIR']) + if len(subcmd) == 0: if help_requested: subcmd = ['help']