Changeset - r13417:1f0ad71700e3
[Not reviewed]
master
0 1 0
smatz - 15 years ago 2009-11-01 17:49:23
smatz@openttd.org
(svn r17936) -Fix: deadlock when trying to create screenshot with too long name (including path)
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/screenshot.cpp
Show inline comments
 
@@ -554,7 +554,11 @@ static char *MakeScreenshotName(const ch
 
	snprintf(&_screenshot_name[len], lengthof(_screenshot_name) - len, ".%s", ext);
 

	
 
	for (serial = 1;; serial++) {
 
		snprintf(filename, lengthof(filename), "%s%s", _personal_dir, _screenshot_name);
 
		if (snprintf(filename, lengthof(filename), "%s%s", _personal_dir, _screenshot_name) >= (int)lengthof(filename)) {
 
			/* We need more characters than MAX_PATH -> end with error */
 
			filename[0] = '\0';
 
			break;
 
		}
 
		if (!FileExists(filename)) break;
 
		/* If file exists try another one with same name, but just with a higher index */
 
		snprintf(&_screenshot_name[len], lengthof(_screenshot_name) - len, "#%d.%s", serial, ext);
0 comments (0 inline, 0 general)