Skip to content
Myr

Applied changes from #296 for better checking.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 73f27f5 · Browse files · 1 file+7 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−4 removed

  • other:+7 added−4 removed

1 file+7 added−4 removed

modified:jinja2/bccache.py+7 added-4 removed
15 unmodified lines
16"""17from os import path, listdir18import os19import sys20import stat21import errno22import marshal23import tempfile24import fnmatch
202 unmodified lines
227228 dirname = '_jinja2-cache-%d' % os.getuid()229 actual_dir = os.path.join(tmpdir, dirname)230230 # 448 == 0700231 try:232 os.mkdir(actual_dir, 448)232 os.mkdir(actual_dir, stat.S_IRWXU)233 except OSError as e:234 if e.errno != errno.EEXIST:235 raise236 try:237 os.chmod(actual_dir, 448)238 if os.stat(actual_dir).st_uid != os.getuid():237 os.chmod(actual_dir, stat.S_IRWXU)238 actual_dir_stat = os.lstat(actual_dir)239 if actual_dir_stat.st_uid != os.getuid() \240 or not stat.S_ISDIR(actual_dir_stat.st_mode) \241 or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU:242 _unsafe_dir()243 except OSError:244 _unsafe_dir()245 return actual_dir
104 unmodified lines