update ftpserver
This commit is contained in:
parent
f5589fbaa4
commit
7c5d473af2
|
@ -164,7 +164,10 @@ char* GetRespond(char* buf, int it,int *ret,int cmd_fd) {
|
||||||
char* buff = (char*)malloc(file_size);
|
char* buff = (char*)malloc(file_size);
|
||||||
|
|
||||||
fread(buf, 1, file_size, file);
|
fread(buf, 1, file_size, file);
|
||||||
write(fd_map[cmd_fd], buff, strlen(buff));
|
int size = write(fd_map[cmd_fd], buff, strlen(buff));
|
||||||
|
if (size < 0) {
|
||||||
|
printf("failed to send message\n");
|
||||||
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
free(buff);
|
free(buff);
|
||||||
|
@ -180,7 +183,10 @@ char* GetRespond(char* buf, int it,int *ret,int cmd_fd) {
|
||||||
|
|
||||||
char* buff = (char*)malloc(5000);
|
char* buff = (char*)malloc(5000);
|
||||||
|
|
||||||
read(fd_map[cmd_fd], buff, sizeof(buff));
|
int size = read(fd_map[cmd_fd], buff, 5000);
|
||||||
|
while (size < 0) {
|
||||||
|
size = read(fd_map[cmd_fd], buff, 5000);
|
||||||
|
}
|
||||||
fwrite(buff, 1, strlen(buff), file);
|
fwrite(buff, 1, strlen(buff), file);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -207,7 +213,7 @@ void *RecvSend(void *arg)
|
||||||
char buf[100];
|
char buf[100];
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
int size;
|
int size;
|
||||||
size = read(cmd_fd, buf, sizeof(buf));
|
size = read(cmd_fd, buf, 100);
|
||||||
|
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
printf("Failed to read or client closed\n");
|
printf("Failed to read or client closed\n");
|
||||||
|
|
Loading…
Reference in New Issue