{
FILE *fp;
char upload_notice[512];
+ static int seq = 0;
if (CC->upload_fp == NULL) {
cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
CC->upload_type = UPL_FILE;
cprintf("%d Upload completed.\n", CIT_OK);
- /* FIXME ... here we need to trigger a network run */
+ if (CC->upload_type == UPL_NET) {
+ char final_filename[PATH_MAX];
+ snprintf(final_filename, sizeof final_filename,
+ "%s/%s.%04lx.%04x",
+ ctdl_netin_dir,
+ CC->net_node,
+ (long)getpid(),
+ ++seq
+ );
+
+ if (link(CC->upl_path, final_filename) == 0) {
+ unlink(CC->upl_path);
+ }
+ else {
+ CtdlLogPrintf(CTDL_ALERT, "Cannot link %d to %d: %s\n",
+ CC->upl_path, final_filename, strerror(errno)
+ );
+ }
+
+ /* FIXME ... here we need to trigger a network run */
+ }
return;
}
ABORTUPL:
close(fd);
- /** Last chance for shutdown exit */
+
+ /* Last chance for shutdown exit */
if(CtdlThreadCheckStop())
return;
if (sock_puts(sock, "UCLS 1") < 0) return;
- /**
+
+ /*
* From here on we must complete or messages will get lost
*/
if (sock_getln(sock, buf, sizeof buf) < 0) return;
- CtdlLogPrintf(CTDL_NOTICE, "Sent %ld octets to <%s>\n",
- bytes_written, remote_nodename);
+ CtdlLogPrintf(CTDL_NOTICE, "Sent %ld octets to <%s>\n", bytes_written, remote_nodename);
CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] == '2') {
CtdlLogPrintf(CTDL_DEBUG, "Removing <%s>\n", sfname);