Originally Posted by xpi0t0s
This line caught my eye: memset(clients[cl]->curdir, '\0', (strlen(clients[cl]->curdir)+1));

This seems to be the only place curdir is initialised. curdir is char[256] which contains garbage until it is initialised, with NO GUARANTEE of a zero byte anywhere in those 256 bytes. So what happens if strlen(curdir) returns, say, 500?
Hi xpi0t0s,

I fixed this but it's not the main problem because when I'm using only this command I don't any problems. You're right that the fact that I'm not testing the max length of the curdir could lead to a problem.
Anyway thank you for the post
Yesterday night I saw that my main problem comes when the server creates a child process ( LIST, RETR, STOR and DELE cases) in the exec_comm.c file. When a new process is created to serve a client request, if there is some error, the system doesn't prints the error message on the screen. But if I remove for a while the fork and I'm just letting the main server to do the requested command ( LIST, RETR, STOR and DELE) I see that there is a problem with the connect function.
At the same time, if I type a netstat -na on a shell, I see that the client waits for a connection but I can't understand why the server can't connect
I'm always working with a localhost, so there aren't any kind of firewalls or something like that.

Command request in the exec_comm.c (with fork())
case LIST:	if( (clients[cl]->pid = fork()) == 0 ){ 
					send(clients[cl]->sock, ok, strlen(ok)+1, 0);
    send(clients[cl]->sock, ok, strlen(ok)+1, 0);
		printf("%s %s\n", commandes[j], clients[cl]->curdir);
and the place where the error message for the connect() function appears
this is at the my_connect() function in exec_comm.c file
if(0 < connect(sd, (struct sockaddr*)&to, tolen)){
		perror("connect my_list");
I suppose there should be the same connection problem with the rest of my commands when a child is created to serve the client.
Any ideas ?

Best regards,