mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
Correct code to insert into a doubly-linked list.
[originally from svn r2553]
This commit is contained in:
parent
1b5cb7adf6
commit
05ae857752
@ -1,4 +1,4 @@
|
||||
/* $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
|
||||
@ -188,7 +188,8 @@ void mac_startsession(Session *s)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,8 @@ Socket mactcp_new(SockAddr addr, int port, int privport, int oobinline,
|
||||
/* 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;
|
||||
|
12
mac/otnet.c
12
mac/otnet.c
@ -313,6 +313,8 @@ Socket ot_new(SockAddr addr, int port, int privport, int oobinline,
|
||||
/* 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;
|
||||
@ -462,9 +464,13 @@ void ot_recv(Actual_Socket s)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user