diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-16 00:02:16 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-16 00:02:16 +0100 |
commit | 41a11a5e83265c7718787b9cfb8b3c109c59b980 (patch) | |
tree | dc43b3b477e0cddcbd4a8d0e4304a428d74d216d /sysdeps/mach | |
parent | 54dda2cdba0766be599e747ee4660aae80aa8647 (diff) | |
download | glibc-41a11a5e83265c7718787b9cfb8b3c109c59b980.tar.gz glibc-41a11a5e83265c7718787b9cfb8b3c109c59b980.tar.xz glibc-41a11a5e83265c7718787b9cfb8b3c109c59b980.zip |
hurd: optimize exec cleanup
When ports are nul we do not need to request their deallocation. It is also useless to look for them in portnames.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 6d52558c24..3cbe075615 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -611,19 +611,21 @@ __rtld_execve (const char *file_name, char *const argv[], } for (i = 0; i < portarraysize; ++i) - { - *pdp++ = ports[i]; - for (j = 0; j < nportnames; j++) - if (portnames[j] == ports[i]) - portnames[j] = MACH_PORT_NULL; - } + if (ports[i] != MACH_PORT_NULL) + { + *pdp++ = ports[i]; + for (j = 0; j < nportnames; j++) + if (portnames[j] == ports[i]) + portnames[j] = MACH_PORT_NULL; + } for (i = 0; i < dtablesize; ++i) - { - *pdp++ = dtable[i]; - for (j = 0; j < nportnames; j++) - if (portnames[j] == dtable[i]) - portnames[j] = MACH_PORT_NULL; - } + if (dtable[i] != MACH_PORT_NULL) + { + *pdp++ = dtable[i]; + for (j = 0; j < nportnames; j++) + if (portnames[j] == dtable[i]) + portnames[j] = MACH_PORT_NULL; + } /* Pack ports to be destroyed together. */ for (i = 0, j = 0; i < nportnames; i++) |