@@ -1566,6 +1566,7 @@ def _createTemporaryDirectory():
15661566 os .makedirs (conf .tmpDir )
15671567
15681568 _ = os .path .join (conf .tmpDir , randomStr ())
1569+
15691570 open (_ , "w+b" ).close ()
15701571 os .remove (_ )
15711572
@@ -1581,16 +1582,19 @@ def _createTemporaryDirectory():
15811582 try :
15821583 if not os .path .isdir (tempfile .gettempdir ()):
15831584 os .makedirs (tempfile .gettempdir ())
1584- except IOError , ex :
1585- errMsg = "there has been a problem while accessing "
1586- errMsg += "system's temporary directory location(s) ('%s'). Please " % getSafeExString (ex )
1587- errMsg += "make sure that there is enough disk space left. If problem persists, "
1588- errMsg += "try to set environment variable 'TEMP' to a location "
1589- errMsg += "writeable by the current user"
1590- raise SqlmapSystemException , errMsg
1585+ except ( OSError , IOError ) , ex :
1586+ warnMsg = "there has been a problem while accessing "
1587+ warnMsg += "system's temporary directory location(s) ('%s'). Please " % getSafeExString (ex )
1588+ warnMsg += "make sure that there is enough disk space left. If problem persists, "
1589+ warnMsg += "try to set environment variable 'TEMP' to a location "
1590+ warnMsg += "writeable by the current user"
1591+ logger . warn ( warnMsg )
15911592
15921593 if "sqlmap" not in (tempfile .tempdir or "" ) or conf .tmpDir and tempfile .tempdir == conf .tmpDir :
1593- tempfile .tempdir = tempfile .mkdtemp (prefix = "sqlmap" , suffix = str (os .getpid ()))
1594+ try :
1595+ tempfile .tempdir = tempfile .mkdtemp (prefix = "sqlmap" , suffix = str (os .getpid ()))
1596+ except (OSError , IOError ), ex :
1597+ tempfile .tempdir = os .path .join (paths .SQLMAP_HOME_PATH , "tmp" , "sqlmap%s%d" % (randomStr (6 ), os .getpid ()))
15941598
15951599 kb .tempDir = tempfile .tempdir
15961600
0 commit comments