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:
vsc 2002-01-05 07:00:19 +00:00
parent 821af0b738
commit 23c4441434
2 changed files with 6 additions and 2 deletions

View File

@ -1426,8 +1426,10 @@ InitSocketStream(int fd, socket_info flags, socket_domain domain) {
for (sno = 0; sno < MaxStreams; ++sno)
if (Stream[sno].status & Free_Stream_f)
break;
if (sno == MaxStreams)
return (PlIOError (SYSTEM_ERROR,TermNil, "new stream not available for socket/4"));
if (sno == MaxStreams) {
PlIOError (SYSTEM_ERROR,TermNil, "new stream not available for socket/4");
return(TermNil);
}
st = &Stream[sno];
st->u.socket.domain = domain;
st->u.socket.flags = flags;

View File

@ -454,6 +454,7 @@ p_socket(void)
#endif
return(FALSE);
}
if (out == TermNil) return(FALSE);
return(unify(out,ARG4));
}
@ -897,6 +898,7 @@ p_socket_accept(void)
out = InitSocketStream(fd, server_session_socket, af_inet );
} else
return(FALSE);
if (out == TermNil) return(FALSE);
return(unify(out,ARG3));
}