Skip to content
Snippets Groups Projects
Commit 955c158d authored by rswindell's avatar rswindell
Browse files

Fixed "keep temp files" options.

parent 9d3f99f8
No related branches found
No related tags found
No related merge requests found
...@@ -505,7 +505,7 @@ static void send_thread(void* arg) ...@@ -505,7 +505,7 @@ static void send_thread(void* arg)
if((fp=fopen(xfer.filename,"rb"))==NULL) { if((fp=fopen(xfer.filename,"rb"))==NULL) {
lprintf("%04d !DATA ERROR %d opening %s",xfer.ctrl_sock,errno,xfer.filename); lprintf("%04d !DATA ERROR %d opening %s",xfer.ctrl_sock,errno,xfer.filename);
sockprintf(xfer.ctrl_sock,"450 ERROR %d opening %s.",errno,xfer.filename); sockprintf(xfer.ctrl_sock,"450 ERROR %d opening %s.",errno,xfer.filename);
if(xfer.tmpfile) if(xfer.tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
remove(xfer.filename); remove(xfer.filename);
close_socket(xfer.data_sock,__LINE__); close_socket(xfer.data_sock,__LINE__);
*xfer.inprogress=FALSE; *xfer.inprogress=FALSE;
...@@ -516,8 +516,8 @@ static void send_thread(void* arg) ...@@ -516,8 +516,8 @@ static void send_thread(void* arg)
*xfer.inprogress=TRUE; *xfer.inprogress=TRUE;
*xfer.aborted=FALSE; *xfer.aborted=FALSE;
if(startup->options&FTP_OPT_DEBUG_DATA || xfer.filepos) if(startup->options&FTP_OPT_DEBUG_DATA || xfer.filepos)
lprintf("%04d DATA socket %d sending from offset %ld" lprintf("%04d DATA socket %d sending %s from offset %ld"
,xfer.ctrl_sock,*xfer.data_sock,xfer.filepos); ,xfer.ctrl_sock,*xfer.data_sock,xfer.filename,xfer.filepos);
fseek(fp,xfer.filepos,SEEK_SET); fseek(fp,xfer.filepos,SEEK_SET);
last_report=start=time(NULL); last_report=start=time(NULL);
...@@ -632,7 +632,11 @@ static void send_thread(void* arg) ...@@ -632,7 +632,11 @@ static void send_thread(void* arg)
fclose(fp); fclose(fp);
*xfer.inprogress=FALSE; *xfer.inprogress=FALSE;
if(xfer.tmpfile || (!error && xfer.delfile)) if(xfer.tmpfile) {
if(!(startup->options&FTP_OPT_KEEP_TEMP_FILES))
remove(xfer.filename);
}
else if(xfer.delfile && !error)
remove(xfer.filename); remove(xfer.filename);
thread_down(); thread_down();
...@@ -1780,8 +1784,8 @@ static void ctrl_thread(void* arg) ...@@ -1780,8 +1784,8 @@ static void ctrl_thread(void* arg)
fclose(fp); fclose(fp);
filexfer(&data_addr,sock,pasv_sock,&data_sock,fname,0L filexfer(&data_addr,sock,pasv_sock,&data_sock,fname,0L
,&transfer_inprogress,&transfer_aborted ,&transfer_inprogress,&transfer_aborted
,startup->options&FTP_OPT_KEEP_TEMP_FILES ? FALSE : TRUE ,TRUE /* delfile */
,TRUE ,TRUE /* tmpfile */
,&lastactive,&user,-1,FALSE,FALSE,FALSE,NULL); ,&lastactive,&user,-1,FALSE,FALSE,FALSE,NULL);
continue; continue;
} /* Local LIST/NLST */ } /* Local LIST/NLST */
...@@ -2252,8 +2256,8 @@ static void ctrl_thread(void* arg) ...@@ -2252,8 +2256,8 @@ static void ctrl_thread(void* arg)
fclose(fp); fclose(fp);
filexfer(&data_addr,sock,pasv_sock,&data_sock,fname,0L filexfer(&data_addr,sock,pasv_sock,&data_sock,fname,0L
,&transfer_inprogress,&transfer_aborted ,&transfer_inprogress,&transfer_aborted
,startup->options&FTP_OPT_KEEP_TEMP_FILES ? FALSE : TRUE ,TRUE /* delfile */
,TRUE ,TRUE /* tmpfile */
,&lastactive,&user,dir,FALSE,FALSE,FALSE,NULL); ,&lastactive,&user,dir,FALSE,FALSE,FALSE,NULL);
continue; continue;
} }
...@@ -2388,10 +2392,7 @@ static void ctrl_thread(void* arg) ...@@ -2388,10 +2392,7 @@ static void ctrl_thread(void* arg)
success=TRUE; success=TRUE;
credits=FALSE; credits=FALSE;
tmpfile=TRUE; tmpfile=TRUE;
if(startup->options&FTP_OPT_KEEP_TEMP_FILES) delfile=TRUE;
delfile=FALSE;
else
delfile=TRUE;
fprintf(fp,"%-*s File/Folder Descriptions\r\n" fprintf(fp,"%-*s File/Folder Descriptions\r\n"
,INDEX_FNAME_LEN,startup->index_file_name); ,INDEX_FNAME_LEN,startup->index_file_name);
if(lib<0) { if(lib<0) {
...@@ -3015,7 +3016,7 @@ void DLLCALL ftp_server(void* arg) ...@@ -3015,7 +3016,7 @@ void DLLCALL ftp_server(void* arg)
} }
t=time(NULL); t=time(NULL);
lprintf("Initializing on %s with options: %lx" lprintf("Initializing on %.24s with options: %lx"
,ctime(&t),startup->options); ,ctime(&t),startup->options);
#ifdef _WIN32 #ifdef _WIN32
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment