cuckoobox/cuckoo — pull request #110 by pdelsante (2013-05-21 15:26:53+00:00)
Title: Avoid attempting to recreate existing dirs

In lib.cuckoo.common.utils, function create_folders() checks whether a given directory already exists before attempting to create it. To do so, it uses os.path.exists: it works, but it would be better to use os.path.isdir, as there might already be a file with the same name of the desired directory and you would end up with some errors.

At the same time, function create_folder() does not check if the directory exists before creating it. So, if you are calling it from inside create_folders(), it works pretty well as it will be create_folders() to perform the check; but if you are calling it directly (for example from inside resultserver.read_next_message()), it will fail if the directory already exists.