Otherwise, there's no way to validate whether or not the operation was actually successful without rescanning.
Signed-off-by: Kyle Russell <bkyleruss...@gmail.com> --- src/doit.c | 16 +++++++++++----- src/main.c | 8 +++++++- src/prelink.h | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/doit.c b/src/doit.c index 1e32ad5..3784866 100644 --- a/src/doit.c +++ b/src/doit.c @@ -237,11 +237,11 @@ error_out: return; } -void +int prelink_all (void) { struct collect_ents l; - int i; + int i, fails = 0; l.ents = (struct prelink_entry **) alloca (prelink_entry_count @@ -250,7 +250,13 @@ prelink_all (void) htab_traverse (prelink_filename_htab, find_ents, &l); for (i = 0; i < l.nents; ++i) - if (l.ents[i]->done == 1 - || (l.ents[i]->done == 0 && l.ents[i]->type == ET_EXEC)) - prelink_ent (l.ents[i]); + { + if (l.ents[i]->done == 1 + || (l.ents[i]->done == 0 && l.ents[i]->type == ET_EXEC)) + prelink_ent (l.ents[i]); + if (l.ents[i]->type == ET_UNPRELINKABLE) + fails++; + } + + return fails; } diff --git a/src/main.c b/src/main.c index 0cea86d..6ba89d5 100644 --- a/src/main.c +++ b/src/main.c @@ -47,6 +47,7 @@ int one_file_system; int enable_cxx_optimizations = 1; int exec_shield; int undo, verify; +int errors; enum verify_method_t verify_method; int quick; int compute_checksum; @@ -90,6 +91,7 @@ static struct argp_option options[] = { {"black-list", 'b', "PATH", 0, "Blacklist path" }, {"cache-file", 'C', "CACHE", 0, "Use CACHE as cache file" }, {"config-file", 'c', "CONF", 0, "Use CONF as configuration file" }, + {"errors", 'e', 0, 0, "Returns an error if all binaries are not prelinkable" }, {"force", 'f', 0, 0, "Force prelinking" }, {"dereference", 'h', 0, 0, "Follow symlinks when processing directory trees from command line" }, {"one-file-system", 'l', 0, 0, "Stay in local file system when processing directories from command line" }, @@ -139,6 +141,9 @@ parse_opt (int key, char *arg, struct argp_state *state) if (add_to_blacklist (arg, dereference, one_file_system)) exit (EXIT_FAILURE); break; + case 'e': + errors = 1; + break; case 'f': force = 1; break; @@ -524,7 +529,8 @@ main (int argc, char *argv[]) prelink_load_cache (); layout_libs (); - prelink_all (); + if(prelink_all () && errors) + return EXIT_FAILURE; if (! no_update && ! dry_run) prelink_save_cache (all); diff --git a/src/prelink.h b/src/prelink.h index 93dbf7a..c7b57e2 100644 --- a/src/prelink.h +++ b/src/prelink.h @@ -574,7 +574,7 @@ int get_relocated_mem (struct prelink_info *info, DSO *dso, GElf_Addr addr, int layout_libs (void); -void prelink_all (void); +int prelink_all (void); int undo_all (void); -- 2.17.1 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto