git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44568
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
}
ser = ast_calloc(1, sizeof(*ser));
if (ser) {
+ int flags = fcntl(fd, F_GETFL);
+ fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
ser->fd = fd;
memcpy(&ser->requestor, &sin, sizeof(ser->requestor));
if ((ser->f = fdopen(ser->fd, "w+"))) {
/* For safety, make sure socket is non-blocking */
flags = fcntl(as, F_GETFL);
fcntl(as, F_SETFL, flags | O_NONBLOCK);
+ } else {
+ flags = fcntl(as, F_GETFL);
+ fcntl(as, F_SETFL, flags & ~O_NONBLOCK);
}
ast_mutex_init(&s->__lock);
s->fd = as;