-/* $Id: macterm.c,v 1.40 2003/01/12 01:25:34 ben Exp $ */
+/* $Id: macterm.c,v 1.41 2003/01/12 13:50:04 ben Exp $ */
/*
* Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris
ShowWindow(s->window);
s->next = sesslist;
s->prev = s->next->prev;
- s->next->prev = &s->next;
+ if (ret->next != NULL)
+ s->next->prev = &s->next;
sesslist = s;
}
/* Add this to the list of all sockets */
ret->next = mactcp.socklist;
ret->prev = &mactcp.socklist;
- ret->next->prev = &ret->next;
+ if (ret->next != NULL)
+ ret->next->prev = &ret->next;
mactcp.socklist = ret;
return (Socket)ret;
/* Add this to the list of all sockets */
ret->next = ot.socklist;
ret->prev = &ot.socklist;
+ if (ret->next != NULL)
+ ret->next->prev = &ret->next;
ot.socklist = ret;
return (Socket) ret;
if (s->frozen) return;
- while ((o = OTRcv(s->ep, buf, sizeof(buf), &flags)) != kOTNoDataErr) {
- plug_receive(s->plug, 0, buf, sizeof(buf));
- }
+ do {
+ o = OTRcv(s->ep, buf, sizeof(buf), &flags);
+ if (o > 0)
+ plug_receive(s->plug, 0, buf, sizeof(buf));
+ if (o < 0 && o != kOTNoDataErr)
+ plug_closing(s->plug, NULL, 0, 0); /* XXX Error msg */
+ } while (o > 0);
}