]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 63045] Reload each intact unloaded shared object
authorDmitry Goncharov <dgoncharov@users.sf.net>
Mon, 12 Sep 2022 05:58:52 +0000 (01:58 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 12 Sep 2022 06:05:18 +0000 (02:05 -0400)
commitee861a4e9f523d06d26ed612ad1a93b6ecb408de
tree43e6d086d6d366bff448675c564ea85d60468c36
parentca4234c4b550618df2194e0617c43bb12524f820
[SV 63045] Reload each intact unloaded shared object

If makefile rules do not update an unloaded shared object, load it
again.  Avoid double loading of the same object if the setup function
returns -1.

* src/filedef.h (struct file): Add "unloaded" flag.
* src/makeint.h (load_file): Take struct file *.
(unload_file): Return int.
* src/main.c (main): Reload unloaded shared objects if they weren't
updated.
* src/commands.c (execute_file_commands): Set "unloaded" and reset
"loaded" when a shared object is unloaded.
* src/read.c (eval): Set "loaded" and reset "unloaded" when a shared
object is loaded.  Add successfully loaded files to the db.
* src/load.c (load_file): Check "loaded" to avoid double loading the
same object.  Fix a memory leak of string loaded.  Return -1, rather
than 1, if the object is already loaded. This fixes double loading of
the same object when the setup routine returns -1.
(load_object): Add a log message.
(unload_file): Return an error on dlclose failure.  Log a message.
* tests/scripts/features/loadapi: Add new tests.
src/commands.c
src/filedef.h
src/load.c
src/main.c
src/makeint.h
src/read.c
tests/scripts/features/loadapi