mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
remove call to pall on unitialied fds
This function assumes that the fd is nonblocking (bug #4053) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -87,6 +87,10 @@ static struct mansession *sessions = NULL;
|
|||||||
static struct manager_action *first_action = NULL;
|
static struct manager_action *first_action = NULL;
|
||||||
AST_MUTEX_DEFINE_STATIC(actionlock);
|
AST_MUTEX_DEFINE_STATIC(actionlock);
|
||||||
|
|
||||||
|
/* If you are calling carefulwrite, it is assumed that you are calling
|
||||||
|
it on a file descriptor that _DOES_ have NONBLOCK set. This way,
|
||||||
|
there is only one system call made to do a write, unless we actually
|
||||||
|
have a need to wait. This way, we get better performance. */
|
||||||
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
|
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
|
||||||
{
|
{
|
||||||
/* Try to write string, but wait no more than ms milliseconds
|
/* Try to write string, but wait no more than ms milliseconds
|
||||||
@@ -94,10 +98,6 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
|
|||||||
int res=0;
|
int res=0;
|
||||||
struct pollfd fds[1];
|
struct pollfd fds[1];
|
||||||
while(len) {
|
while(len) {
|
||||||
/* Wait until writable */
|
|
||||||
res = poll(fds, 1, timeoutms);
|
|
||||||
if (res < 1)
|
|
||||||
return -1;
|
|
||||||
res = write(fd, s, len);
|
res = write(fd, s, len);
|
||||||
if ((res < 0) && (errno != EAGAIN)) {
|
if ((res < 0) && (errno != EAGAIN)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user