Only move from spooltmp to spoolin if there's actually something there.
authorArt Cancro <ajc@citadel.org>
Thu, 18 Nov 2010 02:55:12 +0000 (21:55 -0500)
committerArt Cancro <ajc@citadel.org>
Thu, 18 Nov 2010 02:55:12 +0000 (21:55 -0500)
citadel/modules/network/serv_network.c

index 679b9f44ce38f81630c29c72aceb34f5951e84a5..d0ab940927c317a8f92bfa3a1c8c1bb4942b7d5b 100644 (file)
@@ -2026,18 +2026,20 @@ void receive_spool(int *sock, char *remote_nodename) {
                unlink(tempfilename);
                return;
        }
+
+       CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
        if (download_len > 0) {
                CtdlLogPrintf(CTDL_NOTICE, "Received %ld octets from <%s>\n", download_len, remote_nodename);
+               /*
+                * Now move the temp file to its permanent location.
+                */
+               if (link(tempfilename, permfilename) != 0) {
+                       CtdlLogPrintf(CTDL_ALERT, "Could not link %s to %s: %s\n",
+                               tempfilename, permfilename, strerror(errno)
+                       );
+               }
        }
-       CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
        
-       /* Now move the temp file to its permanent location.
-        */
-       if (link(tempfilename, permfilename) != 0) {
-               CtdlLogPrintf(CTDL_ALERT, "Could not link %s to %s: %s\n",
-                       tempfilename, permfilename, strerror(errno)
-               );
-       }
        unlink(tempfilename);
 }