]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/network/serv_network.c
Only move from spooltmp to spoolin if there's actually something there.
[citadel.git] / 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);
 }