summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-04-04 16:49:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-12-14 11:12:49 +0100
commit46b32dd66293caa33b8404921b4df5e194f703fb (patch)
tree7a2c89cf139acb0f844902f6ee7154f0d34b6d70
parentrtems-fdt: Fix node property access on 64bit (diff)
downloadrtems-46b32dd66293caa33b8404921b4df5e194f703fb.tar.bz2
ftpd: Make socket timeout optional
This feature is not supported by lwIP.
-rw-r--r--cpukit/ftpd/ftpd.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/cpukit/ftpd/ftpd.c b/cpukit/ftpd/ftpd.c
index ceb5c5d5b9..fe5f190242 100644
--- a/cpukit/ftpd/ftpd.c
+++ b/cpukit/ftpd/ftpd.c
@@ -576,7 +576,7 @@ send_reply(FTPD_SessionInfo_t *info, int code, const char *text)
* Output parameters:
* returns 1 on success, 0 on failure.
*/
-static int
+static void
set_socket_timeout(int s, int seconds)
{
int res = 0;
@@ -591,9 +591,6 @@ set_socket_timeout(int s, int seconds)
syslog(LOG_ERR, "ftpd: Can't set send timeout on socket: %s.", serr());
else if(0 != setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, len))
syslog(LOG_ERR, "ftpd: Can't set receive timeout on socket: %s.", serr());
- else
- res = 1;
- return res;
}
/*
@@ -688,8 +685,7 @@ data_socket(FTPD_SessionInfo_t *info)
}
info->data_socket = s;
info->use_default = 1;
- if(s >= 0)
- set_socket_timeout(s, info->idle);
+ set_socket_timeout(s, info->idle);
return s;
}
@@ -1568,8 +1564,8 @@ command_pasv(FTPD_SessionInfo_t *info)
syslog(LOG_ERR, "ftpd: Error binding PASV socket: %s", serr());
else if (0 > listen(s, 1))
syslog(LOG_ERR, "ftpd: Error listening on PASV socket: %s", serr());
- else if (set_socket_timeout(s, info->idle))
{
+ set_socket_timeout(s, info->idle);
if (0 == getsockname(s, (struct sockaddr *)&addr, &addrLen))
{
char buf[FTPD_BUFSIZE];
@@ -2030,12 +2026,11 @@ ftpd_daemon(rtems_task_argument args RTEMS_UNUSED)
ss = accept(s, (struct sockaddr *)&addr, &addrLen);
if (0 > ss)
syslog(LOG_ERR, "ftpd: Error accepting control connection: %s", serr());
- else if(!set_socket_timeout(ss, ftpd_timeout))
- close_socket(ss);
else
{
FTPD_SessionInfo_t *info;
+ set_socket_timeout(ss, ftpd_timeout);
info = task_pool_obtain();
if (NULL == info)
{