open_socket would crash if it could not open a new stream
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@272 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
821af0b738
commit
23c4441434
@ -1426,8 +1426,10 @@ InitSocketStream(int fd, socket_info flags, socket_domain domain) {
|
|||||||
for (sno = 0; sno < MaxStreams; ++sno)
|
for (sno = 0; sno < MaxStreams; ++sno)
|
||||||
if (Stream[sno].status & Free_Stream_f)
|
if (Stream[sno].status & Free_Stream_f)
|
||||||
break;
|
break;
|
||||||
if (sno == MaxStreams)
|
if (sno == MaxStreams) {
|
||||||
return (PlIOError (SYSTEM_ERROR,TermNil, "new stream not available for socket/4"));
|
PlIOError (SYSTEM_ERROR,TermNil, "new stream not available for socket/4");
|
||||||
|
return(TermNil);
|
||||||
|
}
|
||||||
st = &Stream[sno];
|
st = &Stream[sno];
|
||||||
st->u.socket.domain = domain;
|
st->u.socket.domain = domain;
|
||||||
st->u.socket.flags = flags;
|
st->u.socket.flags = flags;
|
||||||
|
@ -454,6 +454,7 @@ p_socket(void)
|
|||||||
#endif
|
#endif
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
if (out == TermNil) return(FALSE);
|
||||||
return(unify(out,ARG4));
|
return(unify(out,ARG4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,6 +898,7 @@ p_socket_accept(void)
|
|||||||
out = InitSocketStream(fd, server_session_socket, af_inet );
|
out = InitSocketStream(fd, server_session_socket, af_inet );
|
||||||
} else
|
} else
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
if (out == TermNil) return(FALSE);
|
||||||
return(unify(out,ARG3));
|
return(unify(out,ARG3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user