Author: toad
Date: 2007-03-29 19:56:20 +0000 (Thu, 29 Mar 2007)
New Revision: 12424
Modified:
trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
Log:
comments
Modified: trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2007-03-29
19:54:59 UTC (rev 12423)
+++ trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2007-03-29
19:56:20 UTC (rev 12424)
@@ -113,6 +113,9 @@
if(diskFile.exists())
throw new
MessageInvalidException(ProtocolErrorMessage.DISK_TARGET_EXISTS, null,
identifier, global);
try {
+ // Check whether we can create it, so that we
return an error early on.
+ // Then delete it, as we have to rename over it
anyway (atomic creation of a file does not guarantee
+ // that it won't be replaced with a symlink).
if(!(tempFile.createNewFile() ||
(tempFile.exists() && tempFile.canRead() && tempFile.canWrite())))
throw new
MessageInvalidException(ProtocolErrorMessage.COULD_NOT_CREATE_FILE, "Could not
create temp file "+tempFile, identifier, global);
tempFile.delete();