mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-03 18:16:17 +01:00
chmod handling
* prefer os.open instead of open && os.chmod * prefer os.fchmod when fd exists
This commit is contained in:
parent
550039f746
commit
5d5185cbc6
@ -570,8 +570,8 @@ def init_basicauth(config):
|
||||
cookiejar.load(ignore_discard=True)
|
||||
except IOError:
|
||||
try:
|
||||
open(cookie_file, 'w').close()
|
||||
os.chmod(cookie_file, 0o600)
|
||||
fd = os.open(cookie_file, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, mode=0o600)
|
||||
os.close(fd)
|
||||
except:
|
||||
#print 'Unable to create cookiejar file: \'%s\'. Using RAM-based cookies.' % cookie_file
|
||||
cookiejar = CookieJar()
|
||||
|
@ -4032,7 +4032,7 @@ def download(url, filename, progress_obj = None, mtime = None):
|
||||
prefix = os.path.basename(filename)
|
||||
path = os.path.dirname(filename)
|
||||
(fd, tmpfile) = tempfile.mkstemp(dir=path, prefix = prefix, suffix = '.osctmp')
|
||||
os.chmod(tmpfile, 0o644)
|
||||
os.fchmod(fd, 0o644)
|
||||
try:
|
||||
o = os.fdopen(fd, 'wb')
|
||||
for buf in streamfile(url, http_GET, BUFSIZE, progress_obj=progress_obj):
|
||||
|
Loading…
Reference in New Issue
Block a user