提交 bf8bb9db 编写于 作者: qiuyiuestc's avatar qiuyiuestc

Fix lm3s ftp upload problem

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@199 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 bd533b37
......@@ -84,9 +84,9 @@
#define RT_USING_DFS
/* SECTION: DFS options */
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 1
#define DFS_FILESYSTEMS_MAX 1
/* the max number of opened files */
#define DFS_FD_MAX 2
#define DFS_FD_MAX 4
/* the max number of cached sector */
#define DFS_CACHE_MAX_NUM 4
......@@ -112,6 +112,9 @@
/* the number of simulatenously active TCP connections*/
#define RT_LWIP_TCP_PCB_NUM 5
/* Ethernet padding size */
#define RT_LWIP_ETH_PAD_SIZE 2
/* TCP sender buffer space*/
#define RT_LWIP_TCP_SND_BUF 1500
/* Enable SNMP protocol*/
......
......@@ -165,7 +165,8 @@ int efs_open(struct dfs_fd* file)
efsdir = (DirList*)rt_malloc(sizeof(DirList));
if(efsdir == RT_NULL)
{
dfs_log(DFS_DEBUG_INFO, ("memory alloc failed"));
dfs_log(DFS_DEBUG_ERROR, ("memory alloc failed"));
rt_free(efsdir);
return -DFS_STATUS_ENOMEM;
}
......@@ -186,7 +187,7 @@ int efs_open(struct dfs_fd* file)
efsfile = (File *)rt_malloc(sizeof(File));
if (efsfile == RT_NULL)
{
dfs_log(DFS_DEBUG_INFO, ("memory alloc failed"));
dfs_log(DFS_DEBUG_ERROR, ("memory alloc failed"));
return -DFS_STATUS_ENOMEM;
}
......
......@@ -246,7 +246,7 @@ int do_list(char* directory, int sockfd)
entry = readdir(dirp);
if (entry == NULL) break;
rt_sprintf(line_buffer, "%s/%s", directory, entry->d_name);
rt_sprintf(line_buffer, "%s/%s", directory, entry->d_name);
#ifdef _WIN32
if (_stat(line_buffer, &s) ==0)
#else
......@@ -262,6 +262,7 @@ int do_list(char* directory, int sockfd)
}
}
closedir(dirp);
return 0;
}
......@@ -288,6 +289,7 @@ int do_simple_list(char* directory, int sockfd)
send(sockfd, line_buffer, line_length, 0);
}
closedir(dirp);
return 0;
}
......@@ -351,6 +353,7 @@ int ftp_process_request(struct ftp_session* session, char *buf)
}
else if (strcmp(parameter_ptr, FTP_USER) == 0)
{
session->is_anonymous = RT_FALSE;
rt_sprintf(sbuf, "331 Password required for %s\r\n", parameter_ptr);
send(session->sockfd, sbuf, strlen(sbuf), 0);
}
......@@ -552,10 +555,12 @@ err1:
FD_ZERO(&readfds);
FD_SET(session->pasv_sockfd, &readfds);
rt_kprintf("Waiting %d seconds for data...\n", tv.tv_sec);
while(select(0, &readfds, 0, 0, &tv)>0 )
while(select(session->pasv_sockfd+1, &readfds, 0, 0, &tv)>0 )
{
if((numbytes=recv(session->pasv_sockfd, sbuf, FTP_BUFFER_SIZE, 0))>0)
{
write(fd, sbuf, numbytes);
}
else if(numbytes==0)
{
close(fd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册