mirror of
https://github.com/InfrastructureServices/vsftpd.git
synced 2025-04-19 01:24:02 +03:00
Prevent recursion in bug()
Resolves: rhbz#1666380
This commit is contained in:
parent
40fea45523
commit
e679a3ce0f
35
sysutil.c
35
sysutil.c
@ -774,21 +774,48 @@ vsf_sysutil_deactivate_linger_failok(int fd)
|
||||
(void) setsockopt(fd, SOL_SOCKET, SO_LINGER, &the_linger, sizeof(the_linger));
|
||||
}
|
||||
|
||||
void
|
||||
vsf_sysutil_activate_noblock(int fd)
|
||||
static int
|
||||
vsf_sysutil_activate_noblock_internal(int fd, int return_err)
|
||||
{
|
||||
int retval;
|
||||
int curr_flags = fcntl(fd, F_GETFL);
|
||||
if (vsf_sysutil_retval_is_error(curr_flags))
|
||||
{
|
||||
die("fcntl");
|
||||
if (return_err)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die("fcntl");
|
||||
}
|
||||
}
|
||||
curr_flags |= O_NONBLOCK;
|
||||
retval = fcntl(fd, F_SETFL, curr_flags);
|
||||
if (retval != 0)
|
||||
{
|
||||
die("fcntl");
|
||||
if (return_err)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die("fcntl");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
vsf_sysutil_activate_noblock(int fd)
|
||||
{
|
||||
(void) vsf_sysutil_activate_noblock_internal(fd, 0);
|
||||
}
|
||||
|
||||
int
|
||||
vsf_sysutil_activate_noblock_no_die(int fd)
|
||||
{
|
||||
return vsf_sysutil_activate_noblock_internal(fd, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -281,6 +281,7 @@ void vsf_sysutil_activate_oobinline(int fd);
|
||||
void vsf_sysutil_activate_linger(int fd);
|
||||
void vsf_sysutil_deactivate_linger_failok(int fd);
|
||||
void vsf_sysutil_activate_noblock(int fd);
|
||||
int vsf_sysutil_activate_noblock_no_die(int fd);
|
||||
void vsf_sysutil_deactivate_noblock(int fd);
|
||||
/* This does SHUT_RDWR */
|
||||
void vsf_sysutil_shutdown_failok(int fd);
|
||||
|
12
utility.c
12
utility.c
@ -47,11 +47,13 @@ bug(const char* p_text)
|
||||
{
|
||||
vsf_log_die(p_text);
|
||||
}
|
||||
vsf_sysutil_activate_noblock(VSFTP_COMMAND_FD);
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "500 OOPS: ", 10);
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, p_text,
|
||||
vsf_sysutil_strlen(p_text));
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "\r\n", 2);
|
||||
if (vsf_sysutil_activate_noblock_no_die(VSFTP_COMMAND_FD) == 0)
|
||||
{
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "500 OOPS: ", 10);
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, p_text,
|
||||
vsf_sysutil_strlen(p_text));
|
||||
(void) vsf_sysutil_write_loop(VSFTP_COMMAND_FD, "\r\n", 2);
|
||||
}
|
||||
if (tunable_log_die)
|
||||
{
|
||||
/* Workaround for https://github.com/systemd/systemd/issues/2913 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user