src/common.c: Fixed a race condition in check_create_dir().