File tree Expand file tree Collapse file tree 1 file changed +10
-19
lines changed
Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Original file line number Diff line number Diff line change 11/*
2- * Minimal FTP server for ELKS and TLVC
2+ * Minimal FTP server for ELKS / TLVC
33 * November 2021 by Helge Skrivervik - [email protected] 44 *
55 * TODO:
66 * - Add ABORT support
7- *
87 */
9-
108#include <time.h>
119#include <sys/socket.h>
1210#include <string.h>
2422#include <sys/wait.h>
2523#include <signal.h>
2624#include <dirent.h>
27-
28- #define BLOAT
29-
30- #ifdef BLOAT
31- #define GLOB /* Enable local globbing - increases size of the executable significantly */
32- #endif
33-
34- #ifdef GLOB
3525#include <pwd.h>
3626#include <regex.h>
37- #endif
27+
28+ #define BLOAT /* Adds MKD, RMD, DELE and SITE commmands */
29+ #define GLOB /* Enable local globbing - increases size significantly */
3830
3931#define CMDBUFSIZ 512
4032#define IOBUFSIZ 1500
@@ -754,11 +746,11 @@ int main(int argc, char **argv) {
754746 if (debug ) printf ("Accepted connection from %s:%u.\n" ,
755747 in_ntoa (client .sin_addr .s_addr ), ntohs (client .sin_port ));
756748
757- if ((pid = fork ()) == -1 ) /* handle new accept*/
749+ if ((pid = fork ()) == -1 )
758750 perror ("ftpd" );
759- else if (pid != 0 ) {
751+ if (pid )
760752 close (controlfd );
761- } else { /* child process */
753+ else { /* child process for accept */
762754 int datafd = -1 , code , quit = FALSE;
763755 unsigned int client_port = 0 ;
764756 //char type = 'I'; /* treat everything as binary */
@@ -1016,10 +1008,9 @@ int main(int argc, char **argv) {
10161008
10171009 }
10181010 alarm (0 );
1019- if (debug ) printf ("Child process exiting...\n" );
1020- close (controlfd );
1021- _exit (0 );
1022- /* End child process */
1011+ close (controlfd );
1012+ _exit (0 );
1013+ /* End child process */
10231014 }
10241015 }
10251016}
You can’t perform that action at this time.
0 commit comments