diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Devices/Network/slirp/libalias/alias_mod.c | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Devices/Network/slirp/libalias/alias_mod.c')
-rw-r--r-- | src/VBox/Devices/Network/slirp/libalias/alias_mod.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c index 2c4fda33..4da99393 100644 --- a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c +++ b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c @@ -141,7 +141,7 @@ _attach_handler(PNATState pData, struct proto_handler *p) _attach_handler(struct proto_handler *p) #endif { - struct proto_handler *b = NULL; + struct proto_handler *b = NULL, *handler_chain_tail = NULL; LIBALIAS_WLOCK_ASSERT(); LIST_FOREACH(b, &handler_chain, entries) { @@ -153,10 +153,14 @@ _attach_handler(struct proto_handler *p) LIST_INSERT_BEFORE(b, p, entries); return (0); } + + /* If the conditions above do not work, we should keep the last + * element of the list in order to insert *p right after it. */ + handler_chain_tail = b; } /* End of list or found right position, inserts here. */ - if (b) - LIST_INSERT_AFTER(b, p, entries); + if (handler_chain_tail) + LIST_INSERT_AFTER(handler_chain_tail, p, entries); else LIST_INSERT_HEAD(&handler_chain, p, entries); return (0); |