1.1 --- a/libipc/lib/src/map.c Sun Jan 21 17:56:36 2024 +0100
1.2 +++ b/libipc/lib/src/map.c Sun Jan 21 18:44:44 2024 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Capability mapping between tasks.
1.6 *
1.7 - * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2022, 2023, 2024 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -46,8 +46,13 @@
1.13 long err = L4_EOK;
1.14 unsigned int i;
1.15
1.16 - for (i = 0; l4_is_valid_cap(mapped_caps[i].cap) && !err; i++)
1.17 - err = ipc_map_capability(task, mapped_caps[i]);
1.18 + /* Use an invalid mapped capability as the sentinel. */
1.19 +
1.20 + for (i = 0; l4_is_valid_cap(mapped_caps[i].mapped_cap) && !err; i++)
1.21 + {
1.22 + if (l4_is_valid_cap(mapped_caps[i].cap))
1.23 + err = ipc_map_capability(task, mapped_caps[i]);
1.24 + }
1.25
1.26 if (count != NULL)
1.27 *count = i;