Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential race condition in 'download_checkmd5.py' #715

Merged
merged 1 commit into from
Feb 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmake/test/download_checkmd5.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

from __future__ import print_function
import errno
import os
import sys
try:
Expand Down Expand Up @@ -87,8 +88,12 @@ def download_md5(uri, dest):
"""
# Create intermediate directories as necessary, #2970
dirname = os.path.dirname(dest)
if len(dirname) and not os.path.exists(dirname):
os.makedirs(dirname)
if len(dirname):
try:
os.makedirs(dirname)
except OSError as e:
if e.errno != errno.EEXIST:
raise

sys.stdout.write('Downloading %s to %s...' % (uri, dest))
sys.stdout.flush()
Expand Down