Skip to content
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
8 changes: 8 additions & 0 deletions src/xmlcli/modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Built-in imports
import os
import stat

# Custom imports
from .. import XmlCli as cli
Expand Down Expand Up @@ -33,7 +34,14 @@ def move_output_files_to(destination_path):
log.error(f'{destination_path} does not exists, not able to move out files\n')
return 1
new_out_dir = os.path.join(destination_path, 'out')
if os.path.islink(new_out_dir):
log.error(f'{new_out_dir} is a symlink, refusing to move out files\n')
return 1
os.makedirs(new_out_dir, exist_ok=True)
# re-check after makedirs to close the pre-create/rmdir-then-symlink TOCTOU window
if stat.S_ISLNK(os.lstat(new_out_dir).st_mode):
log.error(f'{new_out_dir} is a symlink, refusing to move out files\n')
return 1
for root, dirs, files in os.walk(clb.TempFolder):
for name in files:
if not (name == 'Makefile'):
Expand Down
Loading