Changeset: e5a680e6334e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e5a680e6334e
Modified Files:
monetdb5/modules/mal/mal_mapi.mx
Branch: Dec2011
Log Message:
SERVERlistenThread: protect against NULL-pointer
Aparently when the Linux kernel is under stress, it returns a
NULL-pointer for CMSG_FIRSTHDR. Kind of odd, because how else can you
get an ancilary data structure, if there is nothing? Instead of
crashing, report the slightly off "unexpected result" message.
diffs (12 lines):
diff --git a/monetdb5/modules/mal/mal_mapi.mx b/monetdb5/modules/mal/mal_mapi.mx
--- a/monetdb5/modules/mal/mal_mapi.mx
+++ b/monetdb5/modules/mal/mal_mapi.mx
@@ -583,7 +583,7 @@ SERVERlistenThread(SOCKET *Sock)
{ int *c_d;
/* filedescriptor, put it in place of
msgsock */
cmsg = CMSG_FIRSTHDR(&msgh);
- if (!cmsg->cmsg_type == SCM_RIGHTS) {
+ if (!cmsg || !cmsg->cmsg_type ==
SCM_RIGHTS) {
closesocket(msgsock);
fprintf(stderr,
"!mal_mapi.listen: "
"expected
filedescriptor, but "
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list